c - Nested do while loop -


so i've been trying menu more sub menus. main menu while loop if user tried enter irrelevant input, let him re-enter. wondering if can same thing sub menus sub menu loop keeps on going if write valid input. here code:

do {      printf("enter choice: ");         scanf(" %d", &choice1);         switch (choice1)         {                case (1) :               {                     printf("4 printfs of choices");                       printf("enter choice: ");                         scanf(" %d", &choice2);                   switch (choice2)                         {                  case (1):                         {                         stuff                         }                     break;                 case (2) :                        {                         stuff                        }                     break;                case (3) :                        {                         stuff                        }                     break;                case (4) :                        {                          exit(0);                        }                 default :                        {                          printf("sorry not valid choice!\n");                        }                        break;                 }             } while ((choice2 > 0) || (choice2 < 5));         break; 

there still while ending main loop not concern

i think want while ((choice2 < 1) || (choice2 > 4));


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -