So I have made a menu and a guy helped me,
We have used enum in the menu is there anyother way i can do it, cause my teacher is not allowing me to use classes, files and arrays, please help, if u guys have anything simple and better i need it urgently..
here is the code:-
enum MenuState{MenuPlay,MenuHelp,MenuExit}; // the idea of using enum is that instead of using an int to represent a set of values, a type with a restricted set of values in used instead.
MenuState ms=MenuPlay;cout<<" *-=MOD=-* v1.0\n\n\n\n\n";
char ch=0;//or anything other than '\r'
while (ch!='\r')//IIRC getch returns '\r' when user hits enter
{
system("CLS");
switch (ms)
{
case MenuPlay:
system("color 09");
cout<<" *-=MOD=-* v1.0\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<endl;
cout<<b<<" --> PLAY " <<b<<endl;
cout<<b<<" HELP " <<b<<endl;
cout<<b<<" EXIT " <<b<<endl;
cout<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b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<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<endl;
cout<<b<<" PLAY " <<b<<endl;
cout<<b<<" HELP " <<b<<endl;
cout<<b<<" --> EXIT " <<b<<endl;
cout<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<b<<endl;
break;
default: //always provide default, some compilers will not compile until it is there
cout<<"ERROR: Unknown state!\n";
}
ch=getch();//process more input
switch (ch){
case 'w':
case 'W':
ms=MenuPlay;
break;
case 'e':
case 'E':
ms=MenuHelp;
break;
case 'r':
case 'R':
ms=MenuExit;
break;
default:
break;
}
}
//now that we are out of the loop we know that the user hit enter. now we just check ms
switch (ms)
{
case MenuPlay:
break;
case MenuHelp:
//help was selected
break;
case MenuExit:
//exit was selected
break;
}
please anything simple i need it! urgently