char cChoice, cMarker1;
printf("            FLIP!-TAC-TOE 3D            \n\n");
printf("       Enter S to start the game or     \n\n");
printf("               E to exit!               \n\n");
printf("               Choice:                  \n\n ", cChoice);
scanf("%c", &cChoice);

this is the task:Display a simple introduction screen at the beginning of the game. After making a choice (or whenever you want to), you may clear the screen using the system(“CLS”); function.

Can someone help how to generate a code when he/she inputt the letter S the game will start and when he/she inputted E the game will exit? Please?

Edited 5 Years Ago by Ezzaral: Added code tags. Please use them to format any code that you post.

There are probably 100 or more examples of such code right here at Daniweb. See the search box in the upper right corner of this page? Use it!

Game programs use a BIG loop to display the menu choices. They have calls to various functions which depend on the user's choice, and they will return to main (and end the program), when the user chooses the quit exit, or end choice.

Usually, it's easiest to use a simple while(1) or for(;;) loop, and then near the bottom of the loop, test if the user has requested to end the program. If so, the program will break out of the loop. (with a break statement)

Note that if the user wants to quit a single game, that choice will be made in another function, completely. (In yes, another big while or for loop.)

So you have a menu() which calls a play1Game() function, which in turn, will call other functions to actually calculate the right move, make the move, and etc., for that one game. Then the program will return to the menu() function to see whether the user wants to play another game, see game stats, or quit entirely.

This article has been dead for over six months. Start a new discussion instead.