0

So i have a code for a menu and i am facing some problem..
code:-

 do
    {
        ch = getch();

        switch(ch)
        {
            case 'W':
            case 'w':
                system("CLS");
                cout<<"                                                 MOD v1.0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
                cout << "                                                    --> PLAY\n\n";
                cout<<"                                                        HELP\n\n";
                cout<<"                                                        EXIT\n\n";
                break;
            case 'E':
            case 'e':
                system("CLS");
                cout<<"                                                 MOD v1.0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
                cout << "                                                        PLAY\n\n";
                cout<<"                                                    --> HELP\n\n";
                cout<<"                                                        EXIT\n\n";
                break;
            case 'R':
            case 'r':
                system("CLS");
                cout<<"                                                 MOD v1.0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
                cout << "                                                        PLAY\n\n";
                cout<<"                                                        HELP\n\n";
                cout<<"                                                    --> EXIT\n\n";
                break;

        }

    }while (ch != 'Q' && ch!='q');

so what is want is that when I press enter it should take me to a new screen, a new screen for each option....
please help

3
Contributors
2
Replies
31
Views
3 Years
Discussion Span
Last Post by jkhippie
0

Have you debugged and tried following the squence of your code line by line? that way you could read and check for syntax errors that are hard to spot if you are looking at the larger picture and not the bits... remember that being a good programmer or software developer is the ability to diagnose the erors in your programs; and try soving them by rewriting your code. if better, with a defferent approach. There are different ways of writing programs that perform the same functions.

0

If you want something to happen when you press <enter> with the code you have (getch() and switch()) you need "case 10:" getch() returns an ASCII character code (search the web for the whole list). <enter> (or "carriage return") is 10.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.