lfnetwork.com mark read register faq members calendar

Thread: C++ Newbie
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 09-07-2002, 03:02 PM   #1
talldudeX
ICantBelieveitsnotButter
 
talldudeX's Avatar
 
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!

talldudeX is offline   you may: quote & reply,
Old 09-07-2002, 03:09 PM   #2
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-07-2002, 03:10 PM   #3
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
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....

Kuuki is offline   you may: quote & reply,
Old 09-07-2002, 03:15 PM   #4
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-07-2002, 03:19 PM   #5
talldudeX
ICantBelieveitsnotButter
 
talldudeX's Avatar
 
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.

talldudeX is offline   you may: quote & reply,
Old 09-07-2002, 03:20 PM   #6
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
well you didnt have any problem with your code
its just the return statement was a little off

Kuuki is offline   you may: quote & reply,
Old 09-07-2002, 03:32 PM   #7
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-07-2002, 05:13 PM   #8
Jared
Monochrome Man
 
Jared's Avatar
 
Join Date: Feb 2001
Location: Costa Mesa...California.
Posts: 2,735
Forum Veteran 
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
Jared is offline   you may: quote & reply,
Old 09-07-2002, 09:06 PM   #9
talldudeX
ICantBelieveitsnotButter
 
talldudeX's Avatar
 
Join Date: Apr 2002
Location: Pot of Spaghetti
Posts: 1,308
Smartass

talldudeX is offline   you may: quote & reply,
Old 09-07-2002, 10:26 PM   #10
Ewok Hunter
batha fodder
 
Ewok Hunter's Avatar
 
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.
Ewok Hunter is offline   you may: quote & reply,
Old 09-07-2002, 10:35 PM   #11
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-07-2002, 10:55 PM   #12
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
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

Kuuki is offline   you may: quote & reply,
Old 09-07-2002, 10:57 PM   #13
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-07-2002, 10:59 PM   #14
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
nevermind then! im just getting teird

Kuuki is offline   you may: quote & reply,
Old 09-07-2002, 11:01 PM   #15
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-07-2002, 11:05 PM   #16
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
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.

Kuuki is offline   you may: quote & reply,
Old 09-07-2002, 11:07 PM   #17
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-07-2002, 11:12 PM   #18
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
how bout this: you let me beat you or ill have my people send out little increminating photographs of ya... :P

Kuuki is offline   you may: quote & reply,
Old 09-07-2002, 11:14 PM   #19
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-08-2002, 06:56 AM   #20
Cal_da_Darth
Custom title
 
Cal_da_Darth's Avatar
 
Join Date: Sep 2001
Posts: 1,300
Can someone just list the full working code for him?
Cal_da_Darth is offline   you may: quote & reply,
Old 09-08-2002, 10:58 AM   #21
talldudeX
ICantBelieveitsnotButter
 
talldudeX's Avatar
 
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.

talldudeX is offline   you may: quote & reply,
Old 09-08-2002, 09:41 PM   #22
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-08-2002, 09:43 PM   #23
talldudeX
ICantBelieveitsnotButter
 
talldudeX's Avatar
 
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.

talldudeX is offline   you may: quote & reply,
Old 09-08-2002, 10:27 PM   #24
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
mine should have worked just fine...

Kuuki is offline   you may: quote & reply,
Old 09-09-2002, 12:04 AM   #25
SuicidalXWing
We Are Chaos
 
SuicidalXWing's Avatar
 
Join Date: Apr 2002
Posts: 2,552
Forum Veteran 
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.
SuicidalXWing is offline   you may: quote & reply,
Old 09-09-2002, 07:49 PM   #26
Devil Doll
Official Spanker
 
Devil Doll's Avatar
 
Join Date: Sep 2001
Location: Somewhere there...
Posts: 1,367
Current Game: World of Warcraft
Forum Veteran 
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!

Im not a C++ master, but ill 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.



Devil Doll is offline   you may: quote & reply,
Old 09-09-2002, 08:25 PM   #27
Ewok Hunter
batha fodder
 
Ewok Hunter's Avatar
 
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.
Ewok Hunter is offline   you may: quote & reply,
Old 09-09-2002, 09:56 PM   #28
talldudeX
ICantBelieveitsnotButter
 
talldudeX's Avatar
 
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?

talldudeX is offline   you may: quote & reply,
Old 09-09-2002, 10:41 PM   #29
Kuuki
ZOMG It's Kookee!
 
Kuuki's Avatar
 
Join Date: Apr 2002
Posts: 7,121
Hot Topic Starter 10 year veteran! LF Jester Contest winner - LucasCast 
Re: Re: C++ Newbie

Quote:
Originally posted by Devil Doll



Im not a C++ master, but ill 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()

Kuuki is offline   you may: quote & reply,
Old 09-10-2002, 05:05 AM   #30
LukA_YJK
 
LukA_YJK's Avatar
 
Join Date: Feb 2000
Location: Baku, Azerbaijan
Posts: 263
Current Game: Rogue Squadron 3D
10 year veteran! Forum Veteran 
Smile

#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...

LukA_YJK is offline   you may: quote & reply,
Old 09-10-2002, 04:27 PM   #31
Wraith 8
Feral Druid
 
Wraith 8's Avatar
 
Join Date: Oct 2001
Location: Sneek, Netherlands
Posts: 11,798
Current Game: World of Warcraft
LFN Staff Member Forum Veteran 
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
Wraith 8 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > RogueSquadron.net > 1. Community > DownTime: The Pilot's Lounge > C++ Newbie

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:54 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.