"Hello World" C++ Tutorial Error

Sep 7, 2010 at 10:00am
I am new to C++ and would like to learn so I came across this website and started to go through the basics.

For some reason, whatever I try I seem to be getting something wrong. I am using Bloodshed Dev, the latest version.

Here is my code below.


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
cout << "Hello World!" ;
return 0;
system("PAUSE");
return EXIT_SUCCESS;
}
Sep 7, 2010 at 10:04am
Remove return 0; Also, try Code::Blocks -> http://www.codeblocks.org/ Dev is quite old.
Last edited on Sep 7, 2010 at 10:05am
Sep 7, 2010 at 10:33am
Remove return 0;

The reason why you need to remove return 0; is because when you use a return statement in your main function, it will end the program. In your case, you called a return statement before the pause command, resulting in the application closing before you could read the output.
Sep 11, 2010 at 4:06am
Thanks so much guys/gals! Sorry for my late reply but I really appreciate your help!
Topic archived. No new replies allowed.