Here is the while loop and switch in question (track1 defines a bigger loop not shown here):
while (track6 ==1)
{
printf ("would you like to play again? Y or N?\n");
scanf ("%c", &response);
switch (response)
{
case 'Y' : track6 = 2;
break;
case 'N' : printf ("thanks for playing!\n");
track6 = 2, track1 = 2;
break;
default : printf ("response is case-sensitive and must be either Y or N. your response is invalid. please reenter.\n");
}
}
The output I receive is:
would you like to play again? Y or N?
response is case-sensitive and must be either Y or N. your response is invalid. please reenter.
would you like to play again? Y or N?
(prompts for input and then executes correctly)
Seems like it is executing the first printf, skipping the scanf, executing the default, going back to the top of the loop and running properly from there. Any idea why? This is only my 3rd week programming so layman's terms are appreciated.