talldudeX Posted September 7, 2002 Posted September 7, 2002 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!
SuicidalXWing Posted September 7, 2002 Posted September 7, 2002 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.
Kuuki Posted September 7, 2002 Posted September 7, 2002 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....
SuicidalXWing Posted September 7, 2002 Posted September 7, 2002 That's true, but then again it also depends on the version of C++ on how the program reacts Scar.
talldudeX Posted September 7, 2002 Author Posted September 7, 2002 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.
Kuuki Posted September 7, 2002 Posted September 7, 2002 well you didnt have any problem with your code its just the return statement was a little off
SuicidalXWing Posted September 7, 2002 Posted September 7, 2002 that's it its the parenthesis () are important
Jared Posted September 7, 2002 Posted September 7, 2002 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
Ewok Hunter Posted September 8, 2002 Posted September 8, 2002 hmm, do you really[/b need to move to the next line, why not just remove the /n and see if that helps?
SuicidalXWing Posted September 8, 2002 Posted September 8, 2002 the () are what is keeping it from compiling, trust me and Scar on this. We did C++ coding a few months back.
Kuuki Posted September 8, 2002 Posted September 8, 2002 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
SuicidalXWing Posted September 8, 2002 Posted September 8, 2002 yeah, he is. go to the first post, that's his exact code.
SuicidalXWing Posted September 8, 2002 Posted September 8, 2002 Sleep is for the weak. *smacks Scar a few times*
Kuuki Posted September 8, 2002 Posted September 8, 2002 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.
SuicidalXWing Posted September 8, 2002 Posted September 8, 2002 Um, its masochist, if you truly were one, you'd know that. And I haven't eaten in days, who's the weak one? You require nutrients and sleep to survive, I require nothing.
Kuuki Posted September 8, 2002 Posted September 8, 2002 how bout this: you let me beat you or ill have my people send out little increminating photographs of ya...
SuicidalXWing Posted September 8, 2002 Posted September 8, 2002 considering I'm never in photographs, you're gonna have a lot of trouble. Besides, I gave all your little buddies pay raises to beat you into a bloody pulp.
Cal_da_Darth Posted September 8, 2002 Posted September 8, 2002 Can someone just list the full working code for him?
talldudeX Posted September 8, 2002 Author Posted September 8, 2002 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.
SuicidalXWing Posted September 9, 2002 Posted September 9, 2002 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.
talldudeX Posted September 9, 2002 Author Posted September 9, 2002 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.
SuicidalXWing Posted September 9, 2002 Posted September 9, 2002 Yeah, the compiler must be crap. What version of C++ you running?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.