What command line? Any messages? How did you compile your codes?
$g++ -o hello hello.cpp
I don't know anything about C language, but with my C++ experiences, C++ programmer definately should put int in front of main() (Some books say put "void", but my text book and my teacher told me that I should only put "int").
[quote:68a230a78d="CNOOC"]That is not the reason. What else did you do? "\n" only make cursor change to next line.[/quote]
"\n" isn't only meke cursor change to next line, the important thing is to flush the buff. This is reson when you add "\n", the hello displayed after running the program.
Ane if don't add the "\n", when you enter return, the hello will also be showed.