hi, drake here, and I have been making a dos "animated" menu that someone could browse through. The only thing I don't get is how I would "Go Back" to the previous menu. For example, if I was in options in Halo(just an example, I'm not making an amazing menu, this is just for learning puposes) and I press the B button, I go back to the previous menu. Here I have some code and I want to use the number 5 in the difficulty menu to go back and the 'n' character in the quit menu to go back. I believe it has to do w/ do loops but I don't really understand them so please assist in any way possible. Thanks.
failed attempt of do loop in code
Code:
cout <<"\n\n\n\n PRESS ENTER";
cin.ignore(std::cin.rdbuf()->in_avail()+1);
system("cls");
do
{
int menu;
cout<<"G O T Y"<<endl;
cout<<"\n\n\n";
cout<<"'~-MENU-~'\n"<<endl;
cout<<"1 - Start"<<endl;
cout<<"2 - Quit"<<endl;
cout<<"Input: ";
cin>>menu;
switch(menu)
{
case 1:
int difficulty;
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;
std::cout<<"5<-GO BACK"<<std::endl;
cin>>difficulty;
if(difficulty == 1)
{
cout<<"You picked Easy"<<endl;
system("pause");
}
if(difficulty == 2)
{
std::cout<<"You picked Normal"<<std::endl;
system("pause");
}
if(difficulty == 3)
{
std::cout<<"You picked Heroic"<<std::endl;
system("pause");
}
if(difficulty == 4)
{
std::cout<<"You picked Legendary"<<std::endl;
system("pause");
}
case 2:
int quit;
cout<<"quit? (y/n): ";
cin>>quit;
if(quit == 'y')
{
system("cls");
cout<<"Thank's for playing GOTY!\n\n\nGOODBYE";
}
}
}while(difficulty == 5 || quit == 'n')
I have the animation part before all this code you see here, I didn't wanna take up a hole page(pretty much alot of system("cls").
.