Hello, I'm trying to create a program where the user selects a level of a game (the game program works fine). There are three levels: ONE, TWO, and THREE (case sensitive). The idea is that if the user inputs one of those levels, then a switch loop will commence to display the text for the appropiate level. Yet no matter what I input, it goes straight into the error catch while loop. Does someone see the problem, I'm sure it's basic...
This is a function, but all I have in my main is the function call. Thanks!
This is a function, but all I have in my main is the function call. Thanks!
int promptUser(char s)
{
//char s;
int levelChoice;
char input[10];
printf("\nWELCOME TO THE GAME\n");
printf("Which area do you want to start in first?\n(ONE)- Castle\n(TWO)- Swamp\n(THREE)- Forest\n");
scanf("%s", input);
while (strcmp(input, "ONE") != 0 || strcmp(input, "TWO") != 0 || strcmp(input, "THREE") != 0 )
{
printf("Sorry, you must enter the level number in ALL CAPS\nPlease try again.\n");
scanf("%s", input);
}
switch(levelChoice)
{
case 1:
printf("Welcome to the castle!\n");
levelChoice = 1;
break;
case 2:
printf("Welcome to the swamp!\n");
levelChoice = 2;
break;
case 3:
printf("Welcome to the forest!\n");
levelChoice = 3;
break;
}
return levelChoice;
}