Hello!
I have a problem about creating a menu, the switch statement doesn't break. Could somebody please help?
The code is:
do
{
/* ...get input... */
switch(choice)
{
case 1:
submenu();
break;
case 2:
submenu2();
break;
case 3:
printf("\nThe program quits.\n");
exit(0);
default:
printf("\nNo such menu item!\n\n");
break;
}
}
while(choice != 1 || choice != 2 || choice != 3);
After calling submenu or submenu2 it executes the corresponding method, but after, it returns to the get input part again. What am I missing here?
Thanks in advance!