cnandha19
Member level 3
If i pressed 2 it goes to load game(); and then if i pressed Enter key to go next menu that is Playgame ();
and from playgame(); i press escape key to go back to loadgame(); please help how todo this with switch case
and from playgame(); i press escape key to go back to loadgame(); please help how todo this with switch case
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 #include <stdio.h> void playgame() { printf( "Play game called" ); } void loadgame() { printf( "Load game called" ); } void playmultiplayer() { printf( "Play multiplayer game called" ); } int main() { int input; printf( "1. Play game\n" ); printf( "2. Load game\n" ); printf( "3. Play multiplayer\n" ); printf( "4. Exit\n" ); printf( "Selection: " ); scanf( "%d", &input ); switch ( input ) { case 1: /* Note the colon, not a semicolon */ playgame(); break; case 2: loadgame(); Enterkey(); playgame(); break; case 3: playmultiplayer(); break; case 4: printf( "Thanks for playing!\n" ); break; default: printf( "Bad input, quitting!\n" ); break; } getchar(); enter code here }