What does the main() function do

It sets up 2 variables difficulty which stores the current difficulty
and maxDifficulty which defines the highest difficulty setting

if the difficulty is lower than max difficulty it runs PlayGameAtDifficulty
I guess the next part sees whether you pass or fail (not sure how)

and then it adds a +1 (assuming ++ means add 1) to difficulty variable

then it also says “congratulations” and all that.
i dont know what return 0 means

1 Like


main () function is the entry point of any C++ program. It is the point at which execution of program is started. When a C++ program is executed, the execution control goes directly to the main () function.

Privacy & Terms