Small tip;

Here’s a small problem i ran into.

Make sure you put “return 0;” at the bottom most of your codes; otherwise it will end up like this (see attached photo)
It would disregard the rest of your codes below it.


Because “main()” is of type “int”, the compiler expects a return value, this is why you must have the “return 0;” statement.
once main() returns your program will end.

main() must always be of type int!
However you can declare other methods void if you don’t want them to return a value

for example

void GameOver(){std::cout << "Gameover"; }

this function just does its work. I hope this clears up some confusion. When i first got into programming i did not know this very important information.

1 Like

Privacy & Terms