My description of the main() function

I think the code sets the variable ‘difficulty’ to 2. Then ‘maxDifficulty’ is set to 10 to set an end to the game. The while statement takes control any time the variable ‘difficulty’ is below or equal to 10. As long as this is the case, PlayGameAtDifficulty() starts (this is a function, I think). The difficulty level of the game being played is dependent on the value of the variable ‘difficulty’.

I’m honestly not sure what the std::cin.clear() and std::cin.ignore statements do. I don’t even understand it with the comment lines. At the end of the while statement, the value of ‘difficulty’ increases by 1 and the while statement repeats until ‘difficulty’ becomes the value of 11. At that point, the game reaches is conclusion and the player receives the congratulatory message that they are a master hacker before the program ends.

Privacy & Terms