In Visual Studio, go to your project properties dialog. Under Linker->System, make sure that SubSystem is set to Console and the output window will no longer close on you.