Exceptions in C++ how to get back to "main menu"
===

well im studying for an exem so i tried to keep it as simple as possible, but then something very weird heppen, the exercise was to change the following code and by the use of exceptions get back to the main menu.

here's the code of the question:

    void ha_ha_loop()
    {
     int i, c;
    
     while(1)
      {
         for(i=0; i < 3; i++)
         {
           cout << "Ha Ha Ha" << endl;
           sleep(3);
         } // for 
        ask_return(); 
      } // while 
    
    } // ha_ha_loop 
    
    void dollar_loop()
    {
    
     int i;
    
       while(1)
        {
         for(i=0; i < 3; i++)
          {
            cout << "$$$$$$$$$ " << endl;
            sleep(3);
          } // for 
    
          ask_return(); 
        } /* while */
    
    } // dollar_loop 
    
    void mainloop()
    {
      string answer;
    
     while (1)
     {
    
        cout << "Press 1 for Ha Ha Ha." << endl;
        cout <<  "Press 2 for $$$$$$$$." << endl;
        cout << "Press 3 for to quit." << endl;
    
        cin >> answer;
    
        switch (answer[0])
        {
          case '1':
           ha_ha_loop();
          case '2':
           dollar_loop();
          case '3':
           return;
        } // switch 
    
      } // while 
    
    } // mainloop 

and what i did was :

    void ask_return() {
    	char c;
    	cout << "Return to main menu? y/n:"<<endl;
    	cin >> c;
    	if (c=='y') throw 1;
    }
    
    void ha_ha_loop()
    {
     int i, c;
    
     while(1)
      {
         for(i=0; i < 3; i++)
         {
           cout << "Ha Ha Ha" << endl;
    
         } // for 
        ask_return(); 
      } // while 
    
    } // ha_ha_loop 
    
    void dollar_loop()
    {
    
     int i;
    
       while(1)
        {
         for(i=0; i < 3; i++)
          {
            cout << "$$$$$$$$$ " << endl;
          } // for 
    
          ask_return(); 
        } /* while */
    
    } // dollar_loop 
    
    void mainloop()
    {
      char answer;
    
     while (1)
     {
    
        cout << "Press 1 for Ha Ha Ha." << endl;
        cout <<  "Press 2 for $$$$$$$$." << endl;
        cout << "Press 3 for to quit." << endl;
    
        cin >> answer;
    
        switch (answer)
        {
          case '1':
           ha_ha_loop();
          case '2':
           dollar_loop();
          case '3':
           return;
        }
      }
    
    }
    
    
    
    int main() {
    	try {
    		mainloop();
    	} catch (...) {
    		mainloop();
    	}
    }

it works fine at the beginning, but then after one time it terminates my program with an unhandled exception massege... how come?

what is the simplest correct way to do that?
