Parse Error?

Started by
25 comments, last by IRDumb 22 years, 6 months ago
Never mind, got it. Thanks anyways.
Advertisement
Another thing I find interesting is that you''re chaining your functions, which is bad (it uses up stack space, but for now just know that it''s bad.) Here''s a new main() for you:
bool not_done = true;// don''t worry about argc and argvint main(int argc, char *argv[]){  while(not_done)  {      cout<< "Welcome to the trivia game.\n";    cout<< "To play, type in a number 1-4 in accordance with the question.\n";    start();    a();    b();    c();    result();    // add some code to ask the use if he want to quit or play again  }} 

Remove the calls to the other functions inside your current functions (ie, don''t have a() call b() and so forth.) You can''t escape the while loop because the way you currently link your functions will eventually blow your stack (you''ll run out of memory for your program.)

Now as for the parse error, check all your punctuations - semicolons at the end of every line, etc.
Ok, I''ll change the format later tonight.
One thing I don''t really understand is what bool means. How is it used in code?
bool means Boolean (named after the mathematician George Boole - at least I think it was George...), and are variables that evaluate to "true" or "false." Until bool became a part of the C++ language, programmers usually defined their own custom boolean type (which was either an entire integer or a bit in a bitfield); the Win32 API even has BOOL defined!

All you need to know is that a variable of type bool can either be true or false (and you assign "true" or "false" to them like in my example), which means you can use them in branching:
if(boolean_condition){  do_something;}else{  do_something_else;} 
Ok, I kind of knew that.
I re-did my program and it works just as good. (8 questions now!)
I was wondering, can i add sound to a dos program? And if so, how?
quote:Original post by IRDumb
I was wondering, can i add sound to a dos program?


Yes.

quote:And if so, how?


That's a slightly more complicated question. You could add simple beeps by printing the alarm escape character (cout << "\a"; ) You could pull up the old assembler and program the speaker device (aaaaaaaaaaaaaaaaaaaaaaaaargh!)

You could learn to program the SoundBlaster, the Gravis Ultrasound and Ad Lib-compliant sound cards (aaargh! Short scream.) There are libraries that can help you do all this, though, so it's no longer as painful as it used to be.

Or... you could switch to Windows, learn to program DirectSound and kick your feet up after that. Your choice. note, however, that sound is not an introductory topic; you need a firm grasp of programming to do even simple sound programming.

EDIT: misinterpreted smiley.

Edited by - Oluseyi on October 11, 2001 10:43:55 PM
This is the best thread I have seen in this room since I started visiting this forum a few months ago. I think it is really nice when people post actual questions instead of just saying "How do I make a game?" and then getting angry with the people who reply for telling tham that they need to study and learn programming. It is obvious that IRDumb is taking the time to learn how to code instead of trying to find the "magic" program or advice that is going to make a game for him (or her.) Anyway my point is that I am a beginner too, and it makes me happy to see the experienced programmers are willing to help out us students, and to the instant gratification people looking for the magic program and the shortcut my advice is try another job, because the one constant in this forum is that there is no shortcut.

This topic is closed to new replies.

Advertisement