This question already has an answer here:
I’m using Visual Studio 2010 and Windows 7 x64
The command prompt closes after exit, even though I used “Start without debug”. Is there a setting somewhere that I can use?
You can simply press Ctrl+F5 instead of F5 to run the built code. Then it will prompt you to press any key to continue. Or you can use this line ->
system("pause"); at the end of the code to make it wait until you press any key.
However, if you use the above line,
system("pause"); and press Ctrl+F5 to run, it will prompt you twice!