My Solution S02/Lecture23

Is it okay to leave my code like this for the rest of this project or will this create a problem in the future videos?

bool AskToPlayAgain()

cout << "Do you want to play again? ";
string Response = “”;
getline(cin, Response);

cout << "Yes: " << ((Response[0] == 'y') || (Response[0] == 'Y'));
cout << "    ";
cout << "No: " << ((Response[0] == 'n') || (Response[0] == 'N'));
cout << endl;
return false;



your solution will cause that your function AskToPlayAgain will always result into “false” because its returning false instead of proofing the condition of the response.

Anotherpoint is in case of that the user only can repeat while pressing Y or y, you don’t need to check the response for N or n because everything other than Y or y will be false.


Privacy & Terms