Thread: driving me nuts

  1. #1
    Registered User
    Join Date
    Oct 2002

    driving me nuts

    Hi all,

    I cant show you any code cos im at work, but hes what im tryng to do....

    I have a menu (switch statement) and when the user enters the option required it branches off to a new funtion, how would i get it to return to the origanal menu?

    Any ideas would be gratley received....

    Cheers guys

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Encase your switch statement in a loop that is exited when the user selects a particular option from the menu. There are plenty of examples on here... try searching and see what you come up with.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    #include <iostream>
    using std::cout;
    using std::endl;
    using std::cin;
    void Sing(){
    	cout << "Lalala" << endl << endl;
    void Shout(){
    	cout << "Ahhhhhh!!!" << endl << endl;
    int main(){
    	char ch;
    	bool bLoop = true;
    		cout  << endl << "Enter;" << endl << "1. To Sing" << endl;
    		cout << "2. To Shout" << endl << "3. To Quit" << endl;
    		cout << "Then press return" << endl;
    		cin >> ch;
    		if(cin.peek() != '\n'){
    			cout << "Error - 1 digit numer only!" << endl;
    			while(cin.peek() != '\n')cin.ignore();
    		case '1':
    			continue;//The continue statement sends it to the top of the loop
    		case '2':
    		case '3':
    			bLoop = false;
    			cout << "Wrong selection! Try again" << endl;
    	cout << "That's all folks!" << endl;
    	return 0;

  4. #4
    Registered User
    Join Date
    Oct 2002
    cheers guys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. This is driving me nuts...
    By jesin in forum C Programming
    Replies: 5
    Last Post: 11-22-2005, 04:17 AM
  3. This is driving me nuts.
    By Matt13 in forum C Programming
    Replies: 3
    Last Post: 03-25-2004, 09:55 AM
  4. i can't fix it! its driving me nuts
    By faxtoaster in forum C Programming
    Replies: 2
    Last Post: 07-10-2003, 05:46 PM
  5. This compiler is driving me nuts
    By martin_00 in forum C Programming
    Replies: 32
    Last Post: 12-31-2002, 02:25 PM
Website Security Test