Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,115 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,771 people online right now. Registration is fast and FREE... Join Now!




menu

 
Reply to this topicStart new topic

menu

JIN
12 May, 2007 - 07:25 AM
Post #1

New D.I.C Head
*

Joined: 8 May, 2007
Posts: 20


My Contributions
need help trying to get the menu to stay up so the user can hit 1 to display the next menu to choose a month, i heard of using a switch statement or function but how would i do that.


CODE
int x=1;
    int y=1;
    int mainmenu;
    int name;
    int choice;

    






    
    while(x<=6)
    {

    cout<< space << "<>";

    x=x+1;
    }
    cout<<"\nplease enter your name";
    cin>>name;

    {
    cout << "\n\n\n\n     ######################### MENU #################";
    cout<<"\n1) display information";
    cout<<"\n2)";
    cin >> mainmenu;
    }
    {
    //system("cls");
    cout<<"choose month\n 1)\n 2)\n 3)\n 4)\n 5\n 6)\n 7)\n 8)\n 9)\n 10\n 11)\n 12)\n"<<endl;
    cin>>choice;
    choice=3;
    cout<<getbirthstone(march);
    }


This post has been edited by JIN: 12 May, 2007 - 07:38 AM
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Menu
12 May, 2007 - 11:01 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
Can you specify what you mean by having the menu stay up? Is it disappearing? Do you need it displayed multiple times?
User is offlineProfile CardPM
+Quote Post

JIN
RE: Menu
12 May, 2007 - 06:09 PM
Post #3

New D.I.C Head
*

Joined: 8 May, 2007
Posts: 20


My Contributions
i have it show u enter your name and hit answer to take u to the first menu to choose between 1 and 2, but it jumps the one that say menu and goes to my second menu where u choose a month and gives u the birthstone.

i need it to stay on the first menu so when the user hits one the second menu appears with the months
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Menu
13 May, 2007 - 05:45 AM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
This is happening because you are declaring all your variable types as integer...once a name is entered, there is additional information in the buffer, which is used by the next cin statement. Try nsomething like the following:
CODE

string name;
cout<<"\nplease enter your name";
    cin>>name;
    cout << "\n\n\n\n     ######################### MENU #################";
    cin.ignore(100,'\n');
    cout<<"\n1) display information";
    cout<<"\n2)";
    cin >> mainmenu;
    //system("cls");
    cout<<"choose month\n 1)\n 2)\n 3)\n 4)\n 5\n 6)\n 7)\n 8)\n 9)\n 10\n 11)\n 12)\n"<<endl;
    cin>>choice;
    choice=3;
    cout<<getbirthstone(march);

User is offlineProfile CardPM
+Quote Post

JIN
RE: Menu
15 May, 2007 - 04:45 AM
Post #5

New D.I.C Head
*

Joined: 8 May, 2007
Posts: 20


My Contributions
thanks for the help

so when i do the menu for the second menu so when he clicks on to just do the same type of thing

This post has been edited by JIN: 15 May, 2007 - 07:45 AM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 09:53PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month