how to ask user for input in a switch statement that will generate another switch in c, I tried this but my program crashed.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char choise1, choise2;
printf("Starting menu:\n a -> Start\n");
choise1 = getchar();
switch(choise1){
case 'a':
printf("\n a -> New Game\n b -> Load Game");
choise2 = getchar();
switch(choise2){
case 'a':
printf("Start new game.");
break;
case 'b':
printf("Loading game.");
break;
default:
printf("This is a wrong input.");
}
break;
default:
printf("This is a wrong input.");
}
return 0;
}