you have to add something before the return 0 to make the program stop. like this:
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! ";
cout << "I'm a C++ program";
cin.get();
return 0;
}
There are several other ways to do it too -- all of them are correct.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
If you're on windows, a common way to do it is system("PAUSE"); . It gives a prompt like "Press any key to continue..."
Why you should not use that.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Try putting this inbetween the parenthisis of the 'int main()'
int main(int argc, char*argv[])
and on a line inbetween 'return 0;' and the string, put...
system("PAUSE");
And that should help your problems.
Reasons to avoid system("PAUSE");
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343