The int-variables set the beginning difficulty to 2, and a max difficulty of 10. The condition in the while-loop allows us to play from difficulty 2 up to the max-difficulty 10 (<=, so inclusive). It then calls the play game function, which takes the current difficulty as an argument. The difficulty is incremented att the end of the main function. Not sure what .clear() and .ignore() do. They seem to take information from the user though (allow us to type something in the console. std::cout and the following message is printed if one wins the game, and 0 is then returned.
1 Like
Yes that is what tripleX app main function does, but they wanted to know what you think about main function does in general. The main function is a big thing in cpp application because it is the starting point for all application, and all code that is in the main function get run. The cpp application is consider done when the main function has completed.
Ah ok, thanks!
the special function is the main part of the code, if you didn’t write this thing then it didn’t work at all.