Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void PlayAgain()
- {
- string strRestartChoice;
- bool bValidEntry;
- do
- {
- cout << "Would you like to play again? (y/n):";
- cin >> strRestartChoice;
- if(strRestartChoice.at(0) == 89 || strRestartChoice.at(0) == 121)
- {
- bRestartGame = true;
- bValidEntry = true;
- } else if (strRestartChoice.at(0) == 78 || strRestartChoice.at(0) == 110) {
- bRestartGame = false;
- bValidEntry = true;
- } else {
- bValidEntry = false;
- cout << "Error. Invalid input\n";
- }
- getline(cin, strRestartChoice);
- } while (!bValidEntry);
- }
Add Comment
Please, Sign In to add comment