Pausing Your code (Examples included)

Feb 9, 2014 at 3:28pm
So here is a problem i'm facing. And i researched it a little bit but probably not enough.

When you run a simple program in visual C++ 2010 it will run straight through and close like after about half a second.

Now some of the fixes i found all have problems.
For example, System("pause") This is very bad i was told because of the security problems with it. But it does work in just one line.

Next example is the cin.get(); This is okay but when you have a long program you have to insert it three or more times to get the pause your looking for at the end of the program.

Next example is where you set a integer at the begining of the program and at the end you do something like
cout << "Enter a number to continue....";
cin << (Variable you make a int.)


All of these seem a just bit over the edge when C++ can simplify so many things. Any suggestions on which one would work the best? Or is there one i dont know about that may be better then all of the above. Thank you.
Feb 9, 2014 at 3:38pm
Feb 9, 2014 at 3:39pm
1) Remove any code that pauses your program
2) Right click on your project, go to Properties
3) Go in "Configuration Properties" -> "Linker" -> "System"
4) Change the "SubSystem" setting to "Console"
5) Hit "OK"
6) Rebuild your program
7) Run the program with Ctrl+F5 (or with "Start without Debugging" from the Debug menu)
Topic archived. No new replies allowed.