Hello guys, i have this small problem. when i run this code and select 1(new user) it should just print out Testing 1 only but it print out another Invalid Selection. What is the problem here??
Lot of help, Thanks
Coding
ResultCode:int main() { int select = 0; while (select != 51) { printf("1. New User\n"); printf("2. Existing User\n"); printf("3. Exit\n"); printf("Please Enter Selection [ 1-3 ] : "); select = getchar(); switch (select) { case 49: printf("Testing 1\n"); break; case 50: printf("Testing 2\n"); break; case 51: printf("Good Bye\n"); break; default: printf("Invalid Selection\n"); break; } } }
Please Enter Selection [ 1-3 ] : 1
Testing 1
1. New User
2. Existing User
3. Exit
Please Enter Selection [ 1-3 ] : Invalid Selection
1. New User
2. Existing User
3. Exit
Please Enter Selection [ 1-3 ] : 2
Testing 2
1. New User
2. Existing User
3. Exit
Please Enter Selection [ 1-3 ] : Invalid Selection
1. New User
2. Existing User
3. Exit
Please Enter Selection [ 1-3 ] : 3
Good Bye



LinkBack URL
About LinkBacks



