Home | Community | Message Board


This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Shop: PhytoExtractum Buy Bali Kratom Powder   Myyco.com Golden Teacher Liquid Culture For Sale   MagicBag.co Certified Organic All-In-One Grow Bags by Magic Bag

Jump to first unread post Pages: 1
OfflineRonaldFuckingPaul
Our Dear Leader
Male User Gallery


Registered: 10/31/07
Posts: 13,617
Loc: Straight Outta Compton Flag
Last seen: 9 years, 9 months
C++ question (Code error)
    #14923129 - 08/14/11 10:06 PM (12 years, 9 months ago)

Hey guys I'm an absolute noob to C++ as you know and I am encountering an error on Bucky's youtube video "Buckys C++ Programming Tutorials - 3 - More on Printing Text" Basically I'm getting an error on line 8 that says " error: expected primary-expression before ';' token. Here's my code.

#include <iostream>

using namespace std;

int main()
{
cout << "tupac" << endl;
cout << "is dead" <<;
}


It works fine if I delete "cout << "is dead" <<;"  But when I add in that it doesn't work for some reason.



--------------------

Extras: Filter Print Post Top
OfflineRonaldFuckingPaul
Our Dear Leader
Male User Gallery


Registered: 10/31/07
Posts: 13,617
Loc: Straight Outta Compton Flag
Last seen: 9 years, 9 months
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14923158 - 08/14/11 10:11 PM (12 years, 9 months ago)

Oh shit nevermind.  If I add endl; after cout << "is dead" << it works.


--------------------

Extras: Filter Print Post Top
OfflineRonaldFuckingPaul
Our Dear Leader
Male User Gallery


Registered: 10/31/07
Posts: 13,617
Loc: Straight Outta Compton Flag
Last seen: 9 years, 9 months
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14923174 - 08/14/11 10:14 PM (12 years, 9 months ago)

It didn't tell me to do that in the tutorial though.  I just tried it to see if it worked and it did.  Weird.


--------------------

Extras: Filter Print Post Top
OfflineDivinity
Wanderer of Paths
Male User Gallery


Registered: 11/17/09
Posts: 2,732
Loc: Iowa
Last seen: 9 years, 8 months
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14923226 - 08/14/11 10:24 PM (12 years, 9 months ago)

Lol you solved your own question while making a thread about it:lolsy:


--------------------

Extras: Filter Print Post Top
OfflineRonaldFuckingPaul
Our Dear Leader
Male User Gallery


Registered: 10/31/07
Posts: 13,617
Loc: Straight Outta Compton Flag
Last seen: 9 years, 9 months
Re: C++ question (Code error) [Re: Divinity]
    #14923280 - 08/14/11 10:35 PM (12 years, 9 months ago)

Quote:

Divinity said:
Lol you solved your own question while making a thread about it:lolsy:



yea lol.  I was thinking about deleting this thread but I'd like to know from experience C++ users why when I added endl; after cout << "is dead" << it worked.  It didn't tell me that on the tutorial.


--------------------

Extras: Filter Print Post Top
OfflineDivinity
Wanderer of Paths
Male User Gallery


Registered: 11/17/09
Posts: 2,732
Loc: Iowa
Last seen: 9 years, 8 months
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14923307 - 08/14/11 10:42 PM (12 years, 9 months ago)

i dunno what c+++ is or any o that jazz, but glad you solved your problem:feelsgoodman:


--------------------

Extras: Filter Print Post Top
InvisibleDawks
Jolly African Potato


Registered: 06/09/10
Posts: 4,935
Re: C++ question (Code error) [Re: Divinity]
    #14923405 - 08/14/11 11:04 PM (12 years, 9 months ago)

Code:
cout << "is dead" <<;



The problem is:

Code:
<<;



The insertion operator is expecting something after it.

So you could have either omitted the insertion operator and ended the line with the terminator like so:

Code:
#include <iostream>

using namespace std;

int main()
{
cout << "tupac" << endl;
cout << "is dead" << endl;
}



OR you could put another modifier after the insertion operating like endl:

Code:
#include <iostream>

using namespace std;

int main()
{
cout << "tupac" << endl;
cout << "is dead" << endl;
}



endl simply tells the program to start a new line.

Edit:

You should also get into the habit of ending your main() function with return 0;

Code:
#include <iostream>

using namespace std;

int main()
{
cout << "tupac" << endl;
cout << "is dead";

return 0;
}



It's a good habit to get into.


--------------------
date ; unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ; umount ; sleep

Edited by Dawks (08/14/11 11:10 PM)

Extras: Filter Print Post Top
OfflineRonaldFuckingPaul
Our Dear Leader
Male User Gallery


Registered: 10/31/07
Posts: 13,617
Loc: Straight Outta Compton Flag
Last seen: 9 years, 9 months
Re: C++ question (Code error) [Re: Dawks]
    #14923501 - 08/14/11 11:28 PM (12 years, 9 months ago)

Alright man.  I'd give you 5 shrooms if I could but I opted out.:lolfat:  How long does it take to get proficient in C++ enough to do some game programming or anything else?


--------------------

Extras: Filter Print Post Top
InvisibleDawks
Jolly African Potato


Registered: 06/09/10
Posts: 4,935
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14923620 - 08/14/11 11:55 PM (12 years, 9 months ago)

Quote:

reeferaddict69 said:
Alright man.  I'd give you 5 shrooms if I could but I opted out.:lolfat:  How long does it take to get proficient in C++ enough to do some game programming or anything else?




If you enjoy programming a lot and get really into it then I think you'd probably be able to cover all the basics in under 6 months. However generally I'd say it's a good years worth mastering the concepts should be sufficiant.

Personally I love the challenge of solving puzzles, writing new intricate codes to solve tasks. If you're like this then should whizz through it in no time.

Game programming... hmm, that's tough one. There's just so many possibilities when it comes to game programming! things like 3D programing, 2d programing, database programming, interface design/scripting, mission scripting, network/multiplayer programming, AI scripting and the list goes on and on and on.

Once you've moved through your first couple of C++ books you'll pretty fluent in the language. I should be able to say to you "hey you, yeah you with face! code me up an implementation of conway's game of life" and you'd be able to whip it out fairly confidently. At that point you should probably pick up a book on OpenGL or DirectX and start reading through it. You should be coding up little games in no time at all.

So overall I'd say:

1yr (basics) -> 1yr (getting familar, messing with GUI APIs and whatnot) -> 1-2yrs (messing with graphics libraries).

Bam. Only 4 years and I'd already hire you :lol:

If this timeline sounds like a bit much don't be put off, you'll have much fun along the way and you'll most likley pick up a lot of tricks and learn another language or two. :thumbup:

Edit:
You'll probably be able to start pumping out some useful applications after a month or two. Challenge yourself.


--------------------
date ; unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ; umount ; sleep

Edited by Dawks (08/15/11 12:04 AM)

Extras: Filter Print Post Top
Invisiblecortex
[ H ] ψ = [ E ] ψ
Male User Gallery

Registered: 10/08/02
Posts: 15,171
Loc: Gedankenexperiment
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14937052 - 08/17/11 12:36 PM (12 years, 8 months ago)

Did you buy (or "acquire through totally legal digital means") that book I suggested, C++ Primer Plus?


--------------------

Signature (up to 750 characters).

Extras: Filter Print Post Top
OfflineRonaldFuckingPaul
Our Dear Leader
Male User Gallery


Registered: 10/31/07
Posts: 13,617
Loc: Straight Outta Compton Flag
Last seen: 9 years, 9 months
Re: C++ question (Code error) [Re: cortex]
    #14937841 - 08/17/11 03:22 PM (12 years, 8 months ago)

Quote:

cortex said:
Did you buy (or "acquire through totally legal digital means") that book I suggested, C++ Primer Plus?



Not yet.  I will though after I finish the tutorial series on youtube.  Are there any quality torrents of that book?


--------------------

Edited by RonaldFuckingPaul (08/17/11 03:23 PM)

Extras: Filter Print Post Top
Invisiblecortex
[ H ] ψ = [ E ] ψ
Male User Gallery

Registered: 10/08/02
Posts: 15,171
Loc: Gedankenexperiment
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14937970 - 08/17/11 03:43 PM (12 years, 8 months ago)

I honestly wouldn't know, I bought it.  I cannot stand ebooks, especially for texts.

I have a few on my phone that I read when I'm waiting on the bus or whatever, but I still gotta have the real thing for real stuff.


--------------------

Signature (up to 750 characters).

Extras: Filter Print Post Top
InvisibleDawks
Jolly African Potato


Registered: 06/09/10
Posts: 4,935
Re: C++ question (Code error) [Re: RonaldFuckingPaul]
    #14938057 - 08/17/11 03:54 PM (12 years, 8 months ago)

Quote:

reeferaddict69 said:
Quote:

cortex said:
Did you buy (or "acquire through totally legal digital means") that book I suggested, C++ Primer Plus?



Not yet.  I will though after I finish the tutorial series on youtube.  Are there any quality torrents of that book?




You can pirate it here:

Edit: This is not a warez site


--------------------
date ; unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ; umount ; sleep

Extras: Filter Print Post Top
Jump to top Pages: 1

Shop: PhytoExtractum Buy Bali Kratom Powder   Myyco.com Golden Teacher Liquid Culture For Sale   MagicBag.co Certified Organic All-In-One Grow Bags by Magic Bag


Similar ThreadsPosterViewsRepliesLast post
* Looking for a program. Pinhead 1,029 7 08/30/03 09:14 PM
by bivalve
* kernel stack inpage error? sunyata 8,389 7 01/26/07 12:54 PM
by Lasairfion
* Software Developer Deciphers Shredded Paper's Code wingnutx 1,866 9 10/16/03 09:08 PM
by Joshua
* Photoshop 7.0.1 tryout question Lightningfractal 755 2 11/22/03 05:29 PM
by Lightningfractal
* Questions/raving nonsense about Cupyuters and things RedNucleus 512 2 06/26/03 12:16 PM
by
* Go to the store and name your price! with re-code.com
( 1 2 all )
Lana 4,340 39 06/03/03 10:22 AM
by Raadt
* Designing Codes, Possible to make undecipherable?
( 1 2 all )
HagbardCeline 4,186 20 08/31/03 07:49 PM
by Mal_Fenderson
* Programming books or tutorials? Anonymous 1,272 8 06/12/03 01:09 PM
by Anonymous

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: trendal, automan, Northerner
636 topic views. 0 members, 0 guests and 1 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.029 seconds spending 0.007 seconds on 14 queries.