I'm using Visual C++ 2010 Express
and I just started learning C++
.
So when I want to run this code:
#include <iostream>
using namespace std;
int main(){
cout << "Hello World! ";
return 0;
}
It works, but the program exits immediately after I started it, how should I keep the program alive?
In Visual studio you have two options to run a program. There is absolutely no need to modify your code as many other posts are suggesting.
1) Run with debugging. You are probably using this, and to make it stop anywhere, you need to set a breakpoint.
2) Run without debugging. This should leave the console window open, and prompt you to press a key before the window closes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With