|
|
 |
09-07-2002, 03:02 PM
|
#1
|
|
ICantBelieveitsnotButter
Join Date: Apr 2002
Location: Pot of Spaghetti
Posts: 1,308
|
C++ Newbie
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!
|
|
you may:
quote & reply,
|
09-07-2002, 03:09 PM
|
#2
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
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.
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-07-2002, 03:10 PM
|
#3
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
Code:
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....
|
|
you may:
quote & reply,
|
09-07-2002, 03:15 PM
|
#4
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
That's true, but then again it also depends on the version of C++ on how the program reacts Scar.
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-07-2002, 03:19 PM
|
#5
|
|
ICantBelieveitsnotButter
Join Date: Apr 2002
Location: Pot of Spaghetti
Posts: 1,308
|
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.
|
|
you may:
quote & reply,
|
09-07-2002, 03:20 PM
|
#6
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
well you didnt have any problem with your code
its just the return statement was a little off
|
|
you may:
quote & reply,
|
09-07-2002, 03:32 PM
|
#7
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
that's it
its the parenthesis
() are important
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-07-2002, 05:13 PM
|
#8
|
|
Monochrome Man
Join Date: Feb 2001
Location: Costa Mesa...California.
Posts: 2,735
|
Re: C++ Newbie
Quote:
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 
"Honesty may be the best policy, but it's important to remember that apparently, by elimination, dishonesty is the second-best policy." -- George Carlin
|
|
you may:
quote & reply,
|
09-07-2002, 09:06 PM
|
#9
|
|
ICantBelieveitsnotButter
Join Date: Apr 2002
Location: Pot of Spaghetti
Posts: 1,308
|
Smartass 
|
|
you may:
quote & reply,
|
09-07-2002, 10:26 PM
|
#10
|
|
batha fodder
Join Date: May 2002
Posts: 1,923
|
hmm, do you [b]really[/b need to move to the next line, why not just remove the /n and see if that helps?
Originally posted by Rogue9
KIRK "How'd you get rid of them Scotty"
SCOTTY "Why I used that transporters Sir"
KIRK "You didn't..."
SCOTTY "No, Sir I didn't beam them over to the Klingons, even they don't deserve that"
KIRK "Then How..."
SCOTTY "I Spaced the Little Buggers, Didn't seem right to foist 'em off on the Klingons, after all nothing is more evil than a ewok"
KIRK "Excellent Decision Scotty, I'm putting you in for a Comendation.
|
|
you may:
quote & reply,
|
09-07-2002, 10:35 PM
|
#11
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
the () are what is keeping it from compiling, trust me and Scar on this. We did C++ coding a few months back.
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-07-2002, 10:55 PM
|
#12
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
Quote:
Originally posted by Ewok Hunter
[B]hmm, do you really[/b need to move to the next line, why not just remove the /n and see if that helps?
|
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
|
|
you may:
quote & reply,
|
09-07-2002, 10:57 PM
|
#13
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
yeah, he is. go to the first post, that's his exact code.
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-07-2002, 10:59 PM
|
#14
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
nevermind then! im just getting teird
|
|
you may:
quote & reply,
|
09-07-2002, 11:01 PM
|
#15
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
Sleep is for the weak.
*smacks Scar a few times*
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-07-2002, 11:05 PM
|
#16
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
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. 
|
|
you may:
quote & reply,
|
09-07-2002, 11:07 PM
|
#17
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
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.
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-07-2002, 11:12 PM
|
#18
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
how bout this: you let me beat you or ill have my people send out little increminating photographs of ya... :P
|
|
you may:
quote & reply,
|
09-07-2002, 11:14 PM
|
#19
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
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.
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-08-2002, 06:56 AM
|
#20
|
|
Custom title
Join Date: Sep 2001
Posts: 1,300
|
Can someone just list the full working code for him?
|
|
you may:
quote & reply,
|
09-08-2002, 10:58 AM
|
#21
|
|
ICantBelieveitsnotButter
Join Date: Apr 2002
Location: Pot of Spaghetti
Posts: 1,308
|
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.
|
|
you may:
quote & reply,
|
09-08-2002, 09:41 PM
|
#22
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
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.
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-08-2002, 09:43 PM
|
#23
|
|
ICantBelieveitsnotButter
Join Date: Apr 2002
Location: Pot of Spaghetti
Posts: 1,308
|
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.
|
|
you may:
quote & reply,
|
09-08-2002, 10:27 PM
|
#24
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
mine should have worked just fine...
|
|
you may:
quote & reply,
|
09-09-2002, 12:04 AM
|
#25
|
|
We Are Chaos
Join Date: Apr 2002
Posts: 2,552
|
Yeah, the compiler must be crap. What version of C++ you running?
Alright, alright. Let's just calm down and settle this over a nice cyanide pill eating contest, you go first.
|
|
you may:
quote & reply,
|
09-09-2002, 07:49 PM
|
#26
|
|
Official Spanker
Join Date: Sep 2001
Location: Somewhere there...
Posts: 1,367
Current Game: World of Warcraft
|
Re: C++ Newbie
Quote:
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  ).
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. 
|
|
you may:
quote & reply,
|
09-09-2002, 08:25 PM
|
#27
|
|
batha fodder
Join Date: May 2002
Posts: 1,923
|
oh, forgot about that
well here's what the idiots guide says
Code:
#include <iostream.h>
main()
{
cout<<"hello ect.";
return(0);
}
Originally posted by Rogue9
KIRK "How'd you get rid of them Scotty"
SCOTTY "Why I used that transporters Sir"
KIRK "You didn't..."
SCOTTY "No, Sir I didn't beam them over to the Klingons, even they don't deserve that"
KIRK "Then How..."
SCOTTY "I Spaced the Little Buggers, Didn't seem right to foist 'em off on the Klingons, after all nothing is more evil than a ewok"
KIRK "Excellent Decision Scotty, I'm putting you in for a Comendation.
|
|
you may:
quote & reply,
|
09-09-2002, 09:56 PM
|
#28
|
|
ICantBelieveitsnotButter
Join Date: Apr 2002
Location: Pot of Spaghetti
Posts: 1,308
|
Psh. It finally decided to give this message.
"Error: No compiler associated with program."
Well what the hell. I downloaded the borland C++ compiler. How do I make C++ and my new compiler work together?
|
|
you may:
quote & reply,
|
09-09-2002, 10:41 PM
|
#29
|
|
ZOMG It's Kookee!
Join Date: Apr 2002
Posts: 7,075
|
Re: Re: C++ Newbie
Quote:
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 ).
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()
|
|
you may:
quote & reply,
|
09-10-2002, 05:05 AM
|
#30
|
Join Date: Feb 2000
Location: Baku, Azerbaijan
Posts: 261
Current Game: Rogue Squadron 3D
|
#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  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...
|
|
you may:
quote & reply,
|
09-10-2002, 04:27 PM
|
#31
|
|
Feral Druid
Join Date: Oct 2001
Location: Sneek, Netherlands
Posts: 11,798
Current Game: World of Warcraft
|
Borland Delphi? AAAAAAAAAAAAAAAAAAAAAAH i hate that program..... maybe because i realy suck at it  ./....... i still have to learn that program for school.... or else i will fail my education 
SWGalaxies.net - Try some chocolate Gnorts
Fear.
Fear attracts the fearfull.
The strong
The weak
The innocent
The corrupted
Fear
Fear is my ally
|
|
you may:
quote & reply,
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Forum Jump
|
|
|
|
|
|