People are saying "call exit(return code)," but this is bad form. In small programs it is fine, but there are a number of issues with this:
Really, the only time you should exit the problem is with this line in main.cpp:
return 0;
If you are using exit() to handle errors, you should learn about exceptions (and nesting exceptions), as a much more elegant and safe method.