Jump to content

Home

C++ Newbie


talldudeX

Recommended Posts

Originally posted by talldudeX

Yep, that's me...a C++ newbie...and I'm already having problems.

Whenever I try to compile a simple hello world program, it doesn't work for some reason. Yes, I do have a compiler.

 

#include <iostream.h>

 

int main()

{

cout << "Hello world!\n";

 

return 0;

}

 

Can anyone help me out here? Anyone know where to find some good C++ tutorials or games? Thanks!

 

 

I´m not a C++ master, but i´ll try to give you an advice:

Always use this:

void main()

 

you write int main() and not void main() if you never put a void main in you c++ program it will never compile cause it is the principal sentence (include iostream too :p).

 

int is to declare any integer value, and you are declaring the principal main as an integer, only change the int into a void and maybe it will work. ;)

Link to comment
Share on other sites

Originally posted by Devil Doll

 

 

I´m not a C++ master, but i´ll try to give you an advice:

Always use this:

void main()

 

you write int main() and not void main() if you never put a void main in you c++ program it will never compile cause it is the principal sentence (include iostream too :p).

 

int is to declare any integer value, and you are declaring the principal main as an integer, only change the int into a void and maybe it will work. ;)

 

thats why you use a return statement when you int main()

Link to comment
Share on other sites

#include <iostream.h>

 

int main()

{

cout << "Hello world!\n";

 

return 0;

}

 

talldudeX your code is just OK ! It's not true that main should be void... and Borland Turbo C++ is the best ever compiler for DOS. Your error is an environment error, I think. You should check out Options/Directories for all directories are correct. Hope it will help.

 

By the way, I am very glad that somebody asked a question about programming :D I posted once a call to all Rogues for starting learn programming so we can realize our plans togather. I am not a C hacker, but I know Pacal a bit and used Borland Delphi to make all my utilities. Borland is the best, the Force is with them indeed ;)

 

Try http://www.experts-exchange.com you can ask there any question. I'm also there ;) in Delphi Section. Also please ask your specifical programming questions in Gold Squadron forum, I'll try to answer... Sorry, I'm out...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...