I want to wrote a program with menu
and in case the user select 1
until 4
i have simple switch
:
int main() {
char str1[127];
char str2[127];
int result;
int option = 0;
while (option < 1 || option > 4)
{
printoptions();
scanf("%d", &option);
switch (option)
{
case 1:
printf("Please enter first string: ");
gets(str1);
printf("Please enter second string: ");
gets(str2);
// bla bla
break;
case 2:
break;
case 3:
break;
case 4:
break;
default:
break;
}
}
printf("\nPress any key to continue");
getch();
return 0;
}
So my problem here is that after the user select the option 1
i can see this output:
Please enter first string: Please enter second string:
Why this is happening ?