Thread: Input Options.

  1. #1
    C++Pandit
    Join Date
    Jul 2008
    Posts
    49

    Input Options.

    I hav created a menu in DOS window.
    IT looks like this

    MAIN MENU
    1.GAME
    2.HIGHEST SCORES
    3.EXIT

    the code
    Code:
    main()
    { 
       int option,result;
       cout<<"MAIN MENU";
       cout<<"\n1.Game";
       cout<<"\n2.HIGHEST SCORES";
       cout<<"\n3.EXIT";
       cin>>option;
    cin.get();
      
    if(option==1)
    {
      result=system("game.exe");
     cout<<result;
    }
    if(option==2)
    {
      result=system("highest.exe");
     cout<<result;
    }
    if(option==3)
    {
      return 0;
     
    }
    what should i do to make sure the options are executed without the user pressing enter?

    thanks in advance..

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Check the FAQ for an answer to "How to read input without enter", perhaps?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    What compiler are you using?
    Implicit main is invalid in C++.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. Custom Made Safe Input Function
    By Beast() in forum C Programming
    Replies: 6
    Last Post: 08-21-2004, 10:19 PM