So I made a game and everything works just like I want it, but when the game finishes it just stops at the ending credits.It doesnt even close the program. I want the game to ask if it want to play again but it isn't working. any help?
int main() {
int choice;
do
{
cout << "Welcome what would you like to do?" << endl
<< "[1] Play the game" << endl
<< "[2] Quit" << endl
<< "Make your selection: ";
cin >> choice;
while (choice != 1 && choice != 2)
{
cout << endl;
cout << "Sorry I did not get that. Please Select a 1 or 2 to continue... ";
cin >> choice;
}
switch (choice)
{
case 1:
start();
gameplay(word);
break;
case 2:
cout << "Goodbye." << endl;
break;
}
}
while (choice != 2);
return 0;
}
Everything runs but either when you lose the game or win it jus say sorry you lose or yaa you won and doesnt go back to the menu. it should have completed case 1 and looped to show the menu again
bool Quit = false;
while (!Quit) {
menu(); // show the menu
switch (choice)
{
case 1:
start();
gameplay(word);
break;
case 2:
cout << "Goodbye." << endl;
Quit = true;
break;
default: // always have this - it catches bad input
cout << "Invalid option try again\n";
break;
}
}