Thread: i have no idea!?!

  1. #1
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67

    i have no idea!?!

    here is some code for a menu chooser. well, when I run it, i can't seem to get the strings to pop up that tell you what you chose. The program just automatically shuts down after i hit enter after my choice. plz help





    Code:
    //Menu Chooser
    //Demonstrates the switch statement
    
    #include<iostream>
    
    int main()
    {
        std::cout<<"Dfficulty Levels"<<std::endl;
        std::cout<<"1 - Easy"<<std::endl;
        std::cout<<"2 - Normal"<<std::endl;
        std::cout<<"3 - Heroic"<<std::endl;
        std::cout<<"4 - Legendary"<<std::endl;
        
        int choice;
        std::cout<<"Choice: "<<std::endl;
        std::cin>>choice;
        
        switch(choice)
        {
            case 1:
                    std::cout<<"You picked Easy"<<std::endl;
                    break;
            case 2:
                    std::cout<<"You picked Normal"<<std::endl;
                    break;
            case 3:
                    std::cout<<"You picked Heroic"<<std::endl;
                    break;
            case 4:
                    std::cout<<"You picked Legendary"<<std::endl;
                    break;
            default:
                    std::cout<<"You made an illegal choice"<<std::endl;
        }
        
        return 0;
    }

  2. #2
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    This is a great opportunity to learn about debuggers. If you are using visual studio I'll explain how.
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

  3. #3
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    you need this
    Code:
    system("pause")
    it will hold the progress.

    blow me ... ...

  4. #4
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67
    thanks alot, hermitsky, but one more question: how do you get the "Press any key to continue to go away" cause i only want "press enter key to exit".
    thnx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. project idea ???
    By gemini_shooter in forum C Programming
    Replies: 2
    Last Post: 06-09-2005, 09:56 AM
  2. Have an idea?
    By B0bDole in forum Projects and Job Recruitment
    Replies: 46
    Last Post: 01-13-2005, 03:25 PM
  3. A little problem about an idea, help please
    By louis_mine in forum C++ Programming
    Replies: 3
    Last Post: 09-10-2004, 09:52 PM
  4. totally screwed up idea
    By iain in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 08-17-2001, 12:09 PM