Changethe line cout << "I'm a C++ program" << "\n"; to cout << "I'm a C++ program" << "\n\n";
You can reutrn any value(as far as i'm aware). The return code is used to tell the operating whether the program exited successfully. Basically a return value of 0 means yes it did and any other value means no it didn't.
Use "\n" to insert a newline wherever you want. You might have copied your code from somewhere and not known what it meant, since it's your first program.
This will work:
1 2 3 4 5 6
int main ()
{
cout << "\n" << "Hello World!" << "\n";
cout << "I'm a C++ program" << "\n";
return 0;
}
You also don't have to separate things with "<<":
1 2 3 4 5 6
int main ()
{
cout << "\nHello World! \n";
cout << "I'm a C++ program \n";
return 0;
}
But that's a style choice.
Also, a more C++ way to do it is with "endl" instead of "n"
cout << endl << "Hello World!" << endl;
You can return whatever code you want! Usually 0 is used for success, and all other numbers indicate an error. You can check this value from your shell to see how your program did. I forget the command but you can google it.
As part of an unwritten convention, people use other return codes than 0 for the main function when something's gone wrong. I've also known of some programs returning void, but more recently g++ will return an error if you try to have a main function that returns anything other than int...