Hey everyone, I figure I may as well post this simple ASCII based social studies game I have been working on for the past 2 days on here... It isn't very optimized, but it works completely. EXCEPT, when you win or die, and it finishes, instead of exiting it simply goes back to the first problem. This is an easy bug to fix and I will fix it soon.

NOTE: I use system("clear") in this because I'm using Mac OS X. To get this to work on a windows machine, change system("clear") to system("cls")

Yes, this is for South Carolina social studies. Razz

http://pastebin.com/mSf4vD1t

Tell me what you think! Cool
Awesome!
Why do you declare the variable b in generateRand, damageRand, and goldenRand when you don't even use it? Also, the variable a isn't being returned or used for anything in those three functions, so you don't need it. Heck, you don't even need any variables, you can just simply return rand%whatever+whatever.
I know, but somehow my compiler gave me an error if I didn't use B.

Wait woops, that error was for the old routine I have, that B can go.
thydowulays wrote:
I know, but somehow my compiler gave me an error if I didn't use B.

Wait woops, that error was for the old routine I have, that B can go.
Compilers very rarely if ever will do things that flat-out don't make sense, so if you ever run into that sort of situation, I strongly encourage you to try to track down why exactly the compiler is complaining. More often than not, it will turn out to be some subtle error that you overlooked, and that compiler warning will help you find something that might come back and bite you later if left unrepaired.
KermMartian wrote:
Compilers very rarely if ever will do things that flat-out don't make sense, so if you ever run into that sort of situation, I strongly encourage you to try to track down why exactly the compiler is complaining. More often than not, it will turn out to be some subtle error that you overlooked, and that compiler warning will help you find something that might come back and bite you later if left unrepaired.


Along that line, you should always compile with -werror (treat warnings as errors), and ideally -wall. The default set of warnings are almost always errors that *will* cause runtime issues.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement