Jump to content

Home

C++ Newbie


talldudeX

Recommended Posts

Posted

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!

Posted

I believe you've palced the quote in the wrong place. It goes directly after the !

 

or the return may have to go after the second }

 

I'm not completely sure, I haven't coded in C++ since like January, and the summer tends to reformat my brain.

Posted

int main()
{
cout <<"Hello world!" << endl;
return(0);
}

 

btw the C++ program should already have a compiler built into the software that you use to make the code....

Posted

I don't really think the code is the problem. I've even purposely screwed up the code to see what would happen, and the same thing always happens. It says there was an error and could not compile it.

Posted
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!

 

 

 

sounds like a personal problem:D

Posted
Originally posted by Ewok Hunter

hmm, do you really[/b need to move to the next line, why not just remove the /n and see if that helps? [/b]

 

yeah you dont need to move to the next line at all, but it really dont matter cus there isnt anything else being outputed

 

BUT!! are you putting in the #include <iostream.h> in the beginning of your code

cus cout will only work with that header file

Posted

sorry im a Mansochrist, so pain does not affect me. but rest is im afrid something i do need, unlike you, which pain effects your judgement, emotion and proformence...

 

 

...human. :evil2:

Posted

I don't think you understand. I didn't write this code myself, I got it from Sams Teach Yourself Visual C++ in 21 days. Guess I should have mentioned that. Scarface, I tried your code, and it says there were 3 errors.

Posted

int main()

{

cout <<"Hello world!" << endl;

}

return(0);

 

 

 

This could be the code, if I had C++ installed, I could help ya out. Perhaps if ya truly can't figure it out, I'll break down and dig it out and install it.

Posted

Well I talked to a person today that is familiar with C++. They gave me the correct code and it still didn't work. I've come to the conclusion that there's something wrong with my compiler. Thanks for your help anyway, everybody.

Archived

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

×
×
  • Create New...