i m trying to build a turn based text game but im kinda of confused on the menu's
ok here is my issue i want to have 4 menu's in my game
menuDisplay
selectMenu
fightMenu
shopMenu
now what i want is the menuDisplay to be the welecome menu where the user make
begins. the "the selectMenu " will display the fight ,save,shop and quit.
ok her is my dilema is im tryin to figure out is how can i move from the switch to the next menu and continue into the next menu once a player has entered his name
the two issues are what to i need to establish if .else or another switch maybe a do while? im not sure
also ,
how can i code a ck to return if the user has selected his name properly
example: user enters 'eric' i want it to say "eric is this correct" ? y- for yes n-no an be able to return if entered incorrectly
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
ifstream loadFile;
string playerName;
char menuDisplay;
char selectMenu;
char letter;
//menuDisplay
cout << "Welcome to Space Gladiator Coliseum"
<< endl;
while (menuDisplay);
{
//display menu
cout << "What would you like to do?" << endl;
cout << "(enter the letter of your choice)" << endl;
cout << "Press 'N' - To Begin a New Game" << endl;
cout << "Press 'L' - To Load a Previous Game " << endl;
cout << "Press 'Q' - To Quit" << endl;
//choice
cin >> letter;
switch (letter)
{
case'n':
case'N':
cout << " Please Enter Your Fighters Name: " << endl;
cin >> playerName;
if ( playerName < 10 );
{
return playerName;
cout << playerName << " Let's Begin " << endl;
}
else
{
cout << " You have exceed 10 characters for a name." << endl;
cout << " Please Re-enter Name " << endl;
//problem------>
//how to return user name to see if correct
//how to move to next menu
}
return 0;
}
}
}