Thread: C++ menu - help needed

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    17

    C++ menu - help needed

    Hi everyone,

    I am very new to C++ and have only started learning/understanding the language.

    I am trying to create a very simple program - a basic menu system.

    I've started with code like (Below):

    What i'm tryin to achieve is for the user to be presented with a menu screen which gives options 1 - 3. Then the user types one of these option and is navigated to a new screen with new information on it.

    *I am completley stuck on how to navigate to a new screen, any ideas? help greatly appreciated.*

    Code:
    #include <iostream.h> 
    
    int main() 
    { 
      int num;
    
     
      cout << "Enter a number from 1 to 3: "; 
      cin >> num; 
     
      switch(num) { 
        case 1:  
          cout << "TEST1\n"; 
          break; 
        case 2:  
          cout << "TEST2\n"; 
          break; 
        case 3:  
          cout << "TEST3\n"; 
          break; 
        default: 
          cout << "You must enter either 1, 2, or 3.\n"; 
      } 
     
      return 0; 
    }

  2. #2
    ^ Read Backwards^
    Join Date
    Sep 2005
    Location
    Earth
    Posts
    282
    I think all you are asking is how to clear the console screen??
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    17
    Quote Originally Posted by Enahs
    I think all you are asking is how to clear the console screen??
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    Thanks for replying.

    I read the FAQ before posting my thread. The only option that seemed possible was option1.

    Code:
    #include <conio.h> 
    
    int main(void)
    {
      clrscr();
      return(0);
    }
    But when I tried this using my compiler (Salford Plato 3), it did not recognise conio.h

    Any ways of getting round this?

  4. #4
    ^ Read Backwards^
    Join Date
    Sep 2005
    Location
    Earth
    Posts
    282
    Then your compiler does not support the clrscr() function. Try option 6.

    But that is what you are asking help for, clearing the screen? Or did I misunderstand the question?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM