Return to main menu function without using a do while loop

Hi there, I was just wondering if I could use a function to return to a certain point in a program.

I have made a main menu with sub options using switches, however once I use one of the menus for a calculation the console shuts down (after the system pause).

What Im looking to do is have a option after each submenu that will ask them if they would like to return to the main menu or quit. I know this can be done with a do while loop but being quite new to C++ I would like to use a function instead. Any ideas?


Last edited on
Just wrap the code you'd like to loop with a while loop then the sub within another loop. Then when the inside while loop ends(the sub menu), the outer loop would be the menu.

1
2
3
4
5
6
while(quit != true) {
     //main menu
    while(subMenu) {
     // display sub menu
   }
}


Something like that. I'm sure somebody will better help you, I'm at work so that was brief.
Last edited on
Topic archived. No new replies allowed.