Problems with C++

Anything else
DudetheCreator
Posts: 226
Joined: Thu Sep 23, 2004 10:06 pm
Location: Lost in the 404 errors...
Contact:

Post by DudetheCreator » Thu Feb 10, 2005 7:52 pm

i enjoy helping others, it gives me a sense of self-fulfillment

oh no...i think i'm losing my evilness... :twisted: ... :evil: ... :( ... :shock: ... :cry:

Nayr
wicked bad-ass title
Posts: 643
Joined: Wed Jul 07, 2004 9:35 am

Post by Nayr » Fri Feb 11, 2005 3:12 pm

DudetheCreator wrote:press build, btw do you have msn or aim? cuz i don't like posting every 20 seconds lol
then don't. Deal.
Last edited by Nayr on Fri Feb 11, 2005 5:34 pm, edited 1 time in total.

User avatar
Blorx
NOT A FRIGGIN PROGRAMMER
Posts: 3272
Joined: Wed Jan 26, 2005 4:01 pm
Location: South Carolina, United States
Contact:

Post by Blorx » Fri Feb 11, 2005 3:27 pm

Here's a sample code from the book i got:
#include <iostream>

int main()
{
std::cout << "Hello World!\n";
return 0;
}

One problem on Xcode, 87 errors here: #include <iostream>
If I a @c and then a space it reduces it to 2 errors the "#" and the"@". Can someone please help me?

DudetheCreator
Posts: 226
Joined: Thu Sep 23, 2004 10:06 pm
Location: Lost in the 404 errors...
Contact:

Post by DudetheCreator » Fri Feb 11, 2005 7:08 pm

shouldn't that be #include <iostream.h> ?

That's what I was tought.

Nayr
wicked bad-ass title
Posts: 643
Joined: Wed Jul 07, 2004 9:35 am

Post by Nayr » Fri Feb 11, 2005 7:21 pm

that's correct.

DudetheCreator
Posts: 226
Joined: Thu Sep 23, 2004 10:06 pm
Location: Lost in the 404 errors...
Contact:

Post by DudetheCreator » Fri Feb 11, 2005 7:38 pm

good, stupid PC localized instructions!

User avatar
Blorx
NOT A FRIGGIN PROGRAMMER
Posts: 3272
Joined: Wed Jan 26, 2005 4:01 pm
Location: South Carolina, United States
Contact:

Post by Blorx » Fri Feb 11, 2005 10:26 pm

So, it's <iostream.h> for Mac? thanks. Oh, I almost forgot, here are the errors i have:
error: parse error before `@' token
error: parse error before `#' token

Nayr
wicked bad-ass title
Posts: 643
Joined: Wed Jul 07, 2004 9:35 am

Post by Nayr » Sat Feb 12, 2005 10:10 am

post the code.

why d you have an @ sign?

zip
lugaruguru
Posts: 1820
Joined: Mon Jan 26, 2004 12:39 pm
Location: USA, Missouri
Contact:

Post by zip » Sat Feb 12, 2005 10:49 am

I was wondering that.. maybe he is trying to do Obj-C? :o

DudetheCreator
Posts: 226
Joined: Thu Sep 23, 2004 10:06 pm
Location: Lost in the 404 errors...
Contact:

Post by DudetheCreator » Sat Feb 12, 2005 11:09 am

I didn't learn much C. Only how to say Hello World then they said "Right, now were going to teach you beginner to advanced C++"

User avatar
Blorx
NOT A FRIGGIN PROGRAMMER
Posts: 3272
Joined: Wed Jan 26, 2005 4:01 pm
Location: South Carolina, United States
Contact:

Post by Blorx » Sat Feb 12, 2005 12:49 pm

I can't even get Hello World to work. :( That's the code I'm having problems with. :cry:

User avatar
Lugaruman100
The wolfire forum member with no title.
Posts: 749
Joined: Fri Jan 30, 2004 9:40 pm

Post by Lugaruman100 » Sat Feb 12, 2005 1:41 pm

DudetheCreator wrote:I didn't learn much C. Only how to say Hello World then they said "Right, now were going to teach you beginner to advanced C++"
You mean this hello world example?




#ident ''@(#) Hello World - my first program''

#include <stdio.h>

char *format* = ''%s'',
*hello = ''Hello World. . .\n'';

Main()
{
printf ( format, hello ) ;
}

Nayr
wicked bad-ass title
Posts: 643
Joined: Wed Jul 07, 2004 9:35 am

Post by Nayr » Sat Feb 12, 2005 2:21 pm

ok. That book is CRAP! meant for windows...

[edit] here is a website thatshould be much better then the book you use:
http://www.cplusplus.com/doc/tutorial/ [/edit]

here's your first tutorial, written in C, because it is generally more stable.

Code: Select all

#include <stdio.h>

int main(int argc, char *argv[])
{
printf("Hello, World!\n");
return 0;
}

heres the C++ version:

Code: Select all


#include <iostream.h>

int main()
{
std::cout<<"Hello, World!\n";
return 0;
}


DudetheCreator
Posts: 226
Joined: Thu Sep 23, 2004 10:06 pm
Location: Lost in the 404 errors...
Contact:

Post by DudetheCreator » Sat Feb 12, 2005 2:26 pm

THx for the better tutorial

User avatar
Blorx
NOT A FRIGGIN PROGRAMMER
Posts: 3272
Joined: Wed Jan 26, 2005 4:01 pm
Location: South Carolina, United States
Contact:

Post by Blorx » Sat Feb 12, 2005 2:51 pm

that works. Thanks!

Post Reply