I'm perplexed by this do while loop I'm working with. If the string logic is satisfied then it works, but the loop seems to go on infinitely as soon as the string is typed incorrectly.
bool b = true;
for (int i = hours; i > 0; i-=1)
{
b = true;
do
{
string workType;
cout << "Type: 'I hate this.' to advance an hour. You have " << i << " hour(s) remaining.\n";
cin.get();
getline(cin, workType);
if (workType == "I hate this.")
b = false;
elseif (workType != "I hate this.")
{
cout << "You screwed up, try again.\n";
cin.get();
}
} while (b == true);
energy -= 10;
money += 10;
Any insight as to why the do while seems to go on infinitely after an incorrect string would be greatly appreciated.