This article is from the alt.comp.lang.learn.c-c++ Frequently Asked Questions. Compiled by Sunil Rao firstname.lastname@example.org.
This can sometimes occur when you are developing programs using an IDE. A command prompt window opens and displays the output, and control is passed back immediately to the IDE.
To get around this, you can look through the various menus to find a "View Output Screen" option. Alternatively, you could open a command prompt window and change directory to the one your executable is going to end up in and run your executable directly from there.
The solution of using a non-standard function to keep the executable running until a key is pressed is not a very good idea - especially if you are going to run your program outside of the development environment.