Skip to content
Snippets Groups Projects
Commit c9b59a84 authored by TheHresvelgian's avatar TheHresvelgian
Browse files

not optimal but disables invalid menu choices (e.g. add a player mid...

not optimal but disables invalid menu choices (e.g. add a player mid tournament, view rankings when there is no tournamanet
parent 20ea6e39
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,23 @@ int main()
cout << endl << menuToPrint;
command = lesChar("\nCommand: ");
// cout << command;
if (menuToPrint==menuStart)
{
switch (command)
{
case 'S':
startNewTournament();
break;
case 'Q':
cout << endl << "Closing the program";
break;
default:
cout << endl << "Please enter a valid command.";
break;
}
}
else if (menuToPrint==menuSetUp)
{
switch (command)
{
case 'S':
......@@ -72,6 +89,30 @@ int main()
case 'D':
deletePlayer();
break;
case 'Q':
cout << endl << "Closing the program";
break;
case 'F':
gTournaments[0]->printTables();
break;
default:
cout << endl << "Please enter a valid command.";
break;
}
}
else if (menuToPrint==menuDuring)
{
switch (command)
{
case 'S':
startNewTournament();
break;
case 'V':
viewPlayers();
break;
case 'E':
editPlayer();
break;
case 'R':
printRanking();
break;
......@@ -81,13 +122,37 @@ int main()
case 'Q':
cout << endl << "Closing the program";
break;
case 'F':
gTournaments[0]->printTables();
default:
cout << endl << "Please enter a valid command.";
break;
}
}
else if (menuToPrint==menuEnd)
{
switch (command)
{
case 'S':
startNewTournament();
break;
case 'V':
viewPlayers();
break;
case 'R':
printRanking();
break;
case 'Q':
cout << endl << "Closing the program";
break;
default:
cout << endl << "Please enter a valid command.";
break;
}
}
else
{
cout << endl << "A serious error has occured.";
}
}while (command != 'Q');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment