How to return True or False rather then 0 or 1 ! :)

After doing some research, I found a name which convert 1 and 0 into true and false!!
std::cout << std::boolalpha; :sunglasses:

bool Ask_to_play_again()
{
std::cout << "Do you want to play again? ";
std::string response = “”;
getline(std::cin, response);
std::cout << std::boolalpha;
// You can use this line to manipulate the value in converting the 1 to True and the 0 to False!!
std::cout << "First char: " << (response[0] == ‘y’ || response[0] == ‘Y’);
std::cout << std::endl;
return false;
}

Privacy & Terms