while loop - How to go back to menu using case in switch case in C -


how go menu using case in switch case without using goto command. sample:

while(1){   printf("1: basic math\n2. intermediate math\n3. advance math");   printf("enter choice: ");   int choice;   scanf("%d", &choice);    switch(choice)     int thechoices;     case 1:       printf("1. add\n 2. subtract\n3. go menu");       scanf("%d", &thechoices);        switch (thechoices) {          case 1:            //calculation ...          case 2:            //calculation ...          case 3:            // go menu basic math, intermediate math, advance math            // ***** want know how main menu. *****     case 2:     // .... // .................... 

so question again how menu using case 3. when try using keyword break, automatically close program when chose case 3. please help.

use continue; instead. jump out of cases , continue executing code after them, make program return first line after while (1). don't forget close each case break;.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -