cmp prompt problem

i just started to try c++ with the nice tutorial here and i already get a big problem and can't find solution on google. when i run the programm
1
2
3
4
5
6
7
8
9
10
// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}


the consol window(cmd.exe or something) auto close 1 sec after and i ca, t read what's inside of it

i need help to configure winxp to keep consol open after execution

thx a lot
dextor123
You most likely compiled and run it inside an IDE. The console behavior will depend on how you configure the IDE.

To solve this, either:

1.) Open command prompt, "Start->Run", type "cmd", hit Return Key. Then once the command prompt is open, browse through the directory where you compiled the program and type the program name. This will not close the command prompt unless you have something else in your code that will force the console to close.

2.) Tell us what IDE you are using. This way we can tell you how to keep the console open after running the project.
Seconding what vince1027 said. Also, here's what I told the last guy who had this problem:

When you double click on the icon of an exe, it will run, and close as soon as it's finished.

If you use the command line to execute the exe, it will run, and the window will stay open even after the program is done. Then you have all the time you need to read your output.

Never used cmd before? It isn't so hard:
Start -> Run -> enter "cmd", hit enter -> enter the name of your program, hit enter
im using Microsoft visual studio v8.0.5......(if that's the IDE) on windows xp,
Ok, once you compile the project. Go to the menu bar, Select "Debug-> Start without Debugging"

Or simply, hit CTRL + F5
That was so easy,
thanks a lot
Another way easier way is to put
system("PAUSE");
right before your return 0;
This will make the program with until you press a key to continue.
Topic archived. No new replies allowed.