PDA

View Full Version : C++ Tutorial


faramirtook
2005-06-03, 18:19
I'd like to learn C/Cocoa, but I have no prior programming experience, besides a wee itty bit of python. I know how a computer works and I am semi-confident in the command line. I already Googled it, but i'd like to know if there is anything anyone can recommend.

Edit: The more Cocoa-oriented, the better.

BlueRabbit
2005-06-03, 18:44
This web page (http://cocoadevcentral.com/articles/000081.php) seems to cover most of the basics pretty well, and it's OS X-focused, too, which is nice.

faramirtook
2005-06-03, 18:57
Ohh, that looks better, because i do ultimately want to write in Cocoa..

Brad
2005-06-03, 21:10
Free lessons from NCSU. Get 'em while they don't realize they're not password protected!

http://courses.ncsu.edu/csc253/lec/051/

Notes, sample code from the lectures, and videos online. Where are the videos? Download whole lectures as RealVideo files via these links:

http://courses.ncsu.edu/csc253/common/media/01/
http://courses.ncsu.edu/csc253/common/media/02/

Sneaky, eh! :)

This class assumes you have a little background in programming and that you understand some basic programming concepts. I still think these would be beneficial to you as a novice, though. These could go hand-in-hand with the Cocoa Dev Central link provided above.

FYI: Whenever he refers to how stuff works on Unix, that'll be the same way it works on Mac OS X. If you install Apple's Developer Tools, it'll install gcc so you can run it anywhere from the command line.

Verb
2005-06-03, 22:39
Free lessons from NCSU. Get 'em while they don't realize they're not password protected!

Sweet! Any more where that came from?

Brad
2005-06-03, 23:13
Actually, lots of our classes have lecture notes out in the open. Here are some intro-level programming courses with material you can get:

CSC114: Intro to C++ (http://courses.ncsu.edu/csc114/)
CSC116: Intro to Java (http://courses.ncsu.edu/csc116/)
CSC230: C and Software Tools (http://courses.ncsu.edu/csc230/)
CSC234/236: x86 assembly (http://courses.ncsu.edu/csc234/)
CSC253: C for Java Programmers (http://courses.ncsu.edu/csc253/)
CSC255: Intro to Perl (http://courses.ncsu.edu/csc255/)

There's more at the CSC course listing (http://courses.ncsu.edu/csc.html).

bassplayinMacFiend
2005-11-15, 14:31
One of my professors at CCSU has put together some decent guides as well. The start page is --> http://chortle.ccsu.ctstateu.edu/index.htm

There's stuff from Java to ASM to Open GL.

faramirtook
2005-11-15, 16:08
I think I'm going to use my Thanksgiving break and Christmas break to use the lectures Brad offered. Gonna download them all now and then watch the first few, and then study the notes, then go off and look for puzzles I think I can solve with what I know.

Any suggestions for teaching myself C?

Kickaha
2005-11-15, 16:22
My references I learned from:

C: K&R/ANSI
C++: ARM, Scott Meyer's _Effective C++_

That pretty much covered it.

faramirtook
2005-11-15, 16:25
I've decided on C because of Obj-C, my ultimate goal. I'll go out and get the K&R book one day.

Anyone have any simple puzzles they could post that I could work on?

Kickaha
2005-11-15, 16:29
You've got N salesman who need to go to M cities.

Find the optimal routes.

;)

Enki
2005-11-15, 18:02
Can I use ASCII Purple or BlueGene/L ??

bassplayinMacFiend
2005-11-15, 19:38
You've got N salesman who need to go to M cities.

Find the optimal routes.

;)

Paging Dijkstra! Dijkstra, your assistance is needed in aisle 3. :D

ShadowOfGed
2005-11-15, 22:19
CSC234/236: x86 assembly (http://courses.ncsu.edu/csc234/)<vader> Noooooooooooooo! </vader>

Seriously, x86 is a terrible assembly language to learn. Learning assembly in general will really ehance your understanding of how computers work, and how to optimize some C/C++/Obj-C constructs without knowing it (like really getting to know the ins-and-outs of using binary operators to your advantage: use x << 1 instead of x * 2, and such).

I learned z80. Don't ask me what the plaftorm was. It's sorta humiliating and geeky. It ran at 6MHz and has about 24KB of free RAM. Static addressing. 16-bit. *ducks* ;)

Brad
2005-11-15, 22:30
Seriously, x86 is a terrible assembly language to learn.
You and I may know that, but they have to teach to what the industry expects. What good is it going to do to know one low-level language and its quirks when 90% of the world uses something different? At least, that's the school's general philosophy. That's also why they finally wised up and switched back this year to focusing on C instead of Java.

I'm taking another class now that has some brief exercises in MIPS instead; so, x86 isn't truly pervasive here.

On the up side, the professor I had for that x86 class made jabs and criticisms about how asinine x86 is many times through the course of the semester. Man, you should have heard his love-fest about the 68k! :D

Kickaha
2005-11-15, 22:33
Yeah, but teaching crappy info to students just results in crappy engineers. :p

Teach them the RIGHT way to do things, *THEN* show them the crap they're going to have to deal with in The Real World, and maybe they'll get pissed off enough to change it. :p

Teaching them all x86, Windows, and .NET just means we have more of the same sh*t in the marketplace.

Not that I have a strong opinion, or anything.

ShadowOfGed
2005-11-15, 22:43
Yeah, but teaching crappy info to students just results in crappy engineers. :p

Teach them the RIGHT way to do things, *THEN* show them the crap they're going to have to deal with in The Real World, and maybe they'll get pissed off enough to change it. :p

Teaching them all x86, Windows, and .NET just means we have more of the same sh*t in the marketplace.

Not that I have a strong opinion, or anything.Yay I'm not crazy. Well, not completely. :lol:

Yeah, Brad, I'm with Kick on this one; I just meant that x86 should not be the first assembly language students face. Give them something simpler and cleaner like 68000 or z80 (though z80 is very limited, makes 68000 look awesome), and then introduce the x86 kludge. Especially since x86 comes complete with memory management and a whole gamut of other complex stuff, all stacked atop a kludgy hack of an architecture.

... and with Apple moving to x86, it appears that my last hope for forcing the x86 16-bit real mode kludge to vanish has since... vanished. Even though Apple doesn't need it, and from my EE perspective it adds nothing other than power consumption and die size. Thanks Apple, thanks Intel. :no:

AsLan^
2005-11-15, 23:46
I've decided on C because of Obj-C, my ultimate goal. I'll go out and get the K&R book one day.

Anyone have any simple puzzles they could post that I could work on?

There's exercises in the K&R which are pretty good for reinforcing the reading. For me generally, learning doesn't start until my hands start getting dirty with the code.

Wyatt
2005-11-16, 08:51
More college notes for you:
http://www.cs.iupui.edu/~cs230/fall05/index.html
http://www.cs.iupui.edu/~cs240/fall05/index.html

The first is a course in C (which I'm taking now)
The second is in C++ (which I'm taking next semester)

ShadowOfGed
2005-11-16, 09:13
More college notes for you:
http://www.cs.iupui.edu/~cs230/fall05/index.html
http://www.cs.iupui.edu/~cs240/fall05/index.html

The first is a course in C (which I'm taking now)
The second is in C++ (which I'm taking next semester)Bah, who needs courses to learn languages? ;) I learned; it was called RTFM 101. :lol:

bassplayinMacFiend
2005-11-16, 10:03
I'm taking another class now that has some brief exercises in MIPS instead; so, x86 isn't truly pervasive here.


Do you guys use SPIM, the MIPS emulator? That's what we used in our CS254 (ASM) class.

Kickaha
2005-11-16, 13:05
Bah, who needs courses to learn languages? ;) I learned; it was called RTFM 101. :lol:

Yeah, but we're just offering FMTR. ;)

ShadowOfGed
2005-11-16, 13:14
Yeah, but we're just offering FMTR. ;)Good grief, who designed the endianness (http://en.wikipedia.org/wiki/Endianness) of your acronyms? :lol:

(Also, I definitely do understand what you mean by FMTR, but after a long debate about endianness over in this thread (http://forums.applenova.com/showthread.php?postid=263306#post263306), I couldn't resist :p)

Kickaha
2005-11-16, 13:16
You wacky C programmers and your endian issues... ;)

ShadowOfGed
2005-11-16, 13:24
You wacky C programmers and your endian issues... ;)
*looks at your sig*

Yeah, uh-huh. Some things make even C programmers look sane. :p :lol:

Kickaha
2005-11-16, 13:28
:lol: No argument here. :D

Dave
2005-11-16, 13:32
*looks at your sig*

Yeah, uh-huh. Some things make even C programmers look sane. :p :lol:
Speaking of which, is your dissertation publicly available, Kick? I'm not sure I could understand any of it, but I'd love to read it anyway. :)

Kickaha
2005-11-16, 13:47
Soon. :}

It's due to the graduate school by 4pm Monday, I'm doing 'final'* editing now.

* "Dissertations are never finished, only abandoned." -- Fred Brooks

Windswept
2005-11-16, 13:55
Speaking of which, is your dissertation publicly available, Kick? I'm not sure I could understand any of it, but I'd love to read it anyway. :)
Wow! The general clamor is mounting. :D

Hey, I'll pay extra for an *autographed copy*. heh. Will probably be worth a *fortune* someday. Seriously! :)

I don't suppose you'll make any money off the damned thing, will you, Kickaha, old bean? :)

Tsk.

Seems *SO* unfair!!! :grumble:

Kickaha
2005-11-16, 13:57
Not a dime.

That's okay, I have a couple books planned out of the material instead. ;)

Windswept
2005-11-16, 14:07
Not a dime.

That's okay, I have a couple books planned out of the material instead. ;)
Okay, sign me up for those then, too.

I'll have to open up a whole new section of my loft library just for *your* publications. :D

Kickaha
2005-11-16, 14:07
Dear god no, I'm not planning on writing *THAT* much... :)

Windswept
2005-11-16, 14:19
Dear god no, I'm not planning on writing *THAT* much... :)
Oh yeah?

You've *already* written the equivalent of *five books* just with your messageboard posts alone! :lol: :p ;)

heh

Okay, I predict that over the next ten years, you'll become more well-known for your writing than for anything else. That's an *official* prediction.

And ya heard it here first, folks.

*bows*

(Oh, please... no applause. ;) )

Kickaha
2005-11-16, 14:21
Damn, I was hoping it'd be for my brain surgery, quantum physics research, devil-may-care attitude, and touring with my Hong Kong Cavaliers.

Windswept
2005-11-16, 14:39
Damn, I was hoping it'd be for my brain surgery, quantum physics research, devil-may-care attitude, and touring with my Hong Kong Cavaliers.
You mean the brain surgery you're going to *undergo* ? :)

Yeah, I guess I 'did' hear that they were planning on using that cookie-punch scalpel on your cranium. That, and a ten-pound hammer, and some kind of new-fangled vacuum cranial power drill.

Then they'll use one of those time-tested turkey basters to suck out a few unneeded, possibly Scotch-influenced brain cells - you know, to give you a little extra room to expand and grow there... for all the additional knowledge you'll be acquiring over the course of time.

:)

Oops. Completely off-topic. eek!

*hides under rock*

Kickaha
2005-11-16, 14:45
Pblblblblblblblblblt.

Get yerself sum kultur, woman! (http://www.imdb.com/title/tt0086856/)

bassplayinMacFiend
2005-11-16, 16:40
Pblblblblblblblblblt.

Get yerself sum kultur, woman! (http://www.imdb.com/title/tt0086856/)

[Beavis voice]
His name is John Smallberries, huh huh huh

Foj
2005-11-16, 16:45
[Beavis voice]
His name is John Smallberries, huh huh huh
[Butthead voice]
You said Smallberries

Kickaha
2005-11-16, 19:49
That's BigBooTAY!

faramirtook
2005-11-20, 17:03
OK, so I'm using Brad's course, and the appendices in an online book called Teach Yourself C in 21 Days (http://lib.daemon.am/Books/C/) that I have seen in stores. I'm going to get the K&R wednesday unless someone has a better book to get. I'm looking for a reference more than a something to teach me with. Any more suggestions?