My words on what main() function does

As far as I know is main() function, the first function which will be executed when the program starts. A program can’t run without main() function.

In this example on top of the main() function, we can see declaration/definition and Initialisation of variables diffculty and maxDifficulty.

in while loop(which will be executed as long as difficulty is smaller or equal to maxDifficulty) we Call function PlayGameAtDifficulty and pass value in difficulty as parameter.

cin.clear() and cin.ignore() don’t know yet what they do.

After while loop has succesfully finished, we output written message in Parenthesis of cout and end the code.

Privacy & Terms