Triple X Code Level stays the same with wrong answer

My code is coming along and working fine. But not sure if I am doing one section wrong. When I input a wrong answer, the level does not change and would stay like that indefinitely as long as I input wrong answers. But putting in right answers, the levels increase. Am I doing something wrong?

int main()
{

int LevelDifficulty = 1;

const int MaxDifficulty = 5;

while (LevelDifficulty <= MaxDifficulty) // Loop until all levels are completed
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear(); // Clears any errors
std::cin.ignore(); // Discards the buffer

// Did the player complete the level
if (bLevelComplete)
{
    ++LevelDifficulty;
}

}

That’s what it’s supposed to do

Thanks, I was thinking for some reason that you would run out of tries after 5 attempts (per my code) whether you got it right or wrong.

Ohh ok lol np

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms