My understanding of the Main() Function

The understanding of the main function is that to begin with the two ints (integers) at the top are for the difficulty and maxDifficulty and they’re defined so we know where they start and then finish.

The While loop checks if the difficulty is less than or equal to the maxDifficulty and while it’s not equal to it then it’ll execute what’s inside.
Since we’re inside the While loop it has a function called PlayGameAtDifficulty(difficulty) and inside those round brackets is a parameter which relates to the function.

We’ve then got it going down to look at std::cin.clear() which is using the standard library which uses the iostream and then enables the use of the clear() function and the same goes for the line bellow which is std::cin.ignore().

The last line in the while loop increases the difficulty by the amount defined by int difficulty which is 2.

Outside of the While loop the std::cout is allowing a message to be displayed in the terminal and then return zero is already defined in the comments on the document.

Privacy & Terms