My solution for this lecture (23)

Bit simpler than what Ben’s used

bool AskToPlayAgain()
{
cout << "Want tae play again? ";
string Response = “”;
getline(cin,Response);

string TrueFalse;
cout << "Is it y? " << (Response[0] == ‘y’||‘Y’);
cout << endl;
return false;
}

Your defining a variable wrong and not using it.

You definded string TrueFalse; but as your name describes it is a boolean so needs to be bool TrueFalse;
But i don’t see you use it, since you put the user input in Response variable.

Don’t take it as critique but more of an observation and guiding you. Back in the earlier days you needed to be careful with the amount of memory your application was using, and every declaration takes up memory.

Privacy & Terms