A slight problem was encountered when exiting a program, it returns immediately to the console. If there is for example a diagnostic string that you want to look for, it will not be visible as the program terminates and the window returns to the standard console.

A simple solution is to have a getch() right before the function exits, However this may be platform specific (it requires conio.h, see previous post), and it does not conform to the C++ standard.
The more accepted way is to do: cin.get();

Both of the above methods simply halt the execution of the code until a character is entered at the keyboard. Then the program terminates and control reverts back tot he command line