command prompt opens and closes

No matter what examples i put into the compiler i'm using (i'm doing the tutorials on the site and i tried the hello world and the variable examples), the .exe just creates a command prompt for a split second and closes it. Maybe this is what's supposed to happen, but i just figured you'd be able to see what the code produces etc. Can anyone help?
http://www.cplusplus.com/forum/beginner/1988/
Deals EXACTLY with your problem.
ah thanks. Is there any way to make the press any key to continue appear a line lower than the last thing in the prompt? it looks odd to have
Hello World!Press any key to continue...
1
2
3
cout << "Hello, world!\n"; //\n is an escape character for a newline
system("pause");
return 0;

The "\n" acts like the ENTER key and creates a newline. Try it.
Topic archived. No new replies allowed.