PDA

View Full Version : Begginer c++ book a noob can read


imported_ExOdUs
07-15-2003, 11:48 AM
HI, I was wondering if you expert programers can give a list of some c ++ books that you recommend for a begginer to read.And if you can also give me some names of some windows programming and mfc books i would really appreciate it.

THANKS:D

gish
07-15-2003, 12:15 PM
i really like the "primer" series....and o'reilly makes fantistic books.

sans-hubris
07-15-2003, 02:07 PM
Did you look through the C/C++ Resources (http://coderforums.com/showthread.php?s=&threadid=235) thread? There are some good books in there.

Progman
07-17-2003, 06:57 PM
I suggest looking for some books written by Bjarne Stroustrup himself...If anyone could write a good book about C++ it would be the creator of C++ :D

sicarius
07-17-2003, 08:20 PM
I would actually start out by learning C. It is a much "simpler" language and will get you up and running with pointers much more quickly.

So I would first read:

The C Programming Language By K&R

Then I would read:

The C++ Programming Language By Bjarne Stroustrup

DNAunion2000
07-17-2003, 10:53 PM
Progman: I suggest looking for some books written by Bjarne Stroustrup himself...If anyone could write a good book about C++ it would be the creator of C++ :D

DNAunion: I'm not sure about that advice. The one book by Stroustrup that was at my local bookstore started off way over a beginner's head. I don't know if it is the same book, but here's something else:

"Because the author is the language's creator, the most definitive text on C++ is The C++ Programming Language, Third Edition by Bjarne Stroustrup (Addison Wesley, 1997). Every serious C++ programmer should have a copy of this book. It assumes a certain level of sophistication, so it's not for beginners. However, it's clearly written, after you've mastered the fundamentals it's an invaluable aid to the finer points of C++ usage." (bold added, Object-Oriented Progamming in C++: Fourth Edition, Robert Lafore, Sams, 2002, p978 )

DNAunion2000
07-17-2003, 11:02 PM
sicarius: I would actually start out by learning C. It is a much "simpler" language and will get you up and running with pointers much more quickly.

DNAunion: I hate to be so contradictory tonight, but...

Personally, I'd advise someone to start off with C++ and skip the C. This author seems to agree.

"A few institutions still want their students to learn C before learning C++. In our view this a mistake. C and C++ are entirely separate languages. It's true that their syntax is similar, and C is actually a subset of C++. But the similarity is largely a historical accident. In fact, the basic approach in a C++ program is radically different from that in a C program.

C++ has overtaken C as the preferred language for serious software development. Thus we don't believe it is necessary or advantageous to teach C before teaching C++. Students who don't know C are saved the time and trouble of learning C and then learning C++, an inefficient approach. (Object-Oriented Programming in C++: Fourth Edition, Robert Lafore, Sams, 2002, p5)


DNAunion: And...

sicarius: Then I would read:

The C++ Programming Language By Bjarne Stroustrup

DNAunion: Again, I don't think that is a good book for a beginner (my previous post says more).

DNAunion2000
07-17-2003, 11:07 PM
DNAunion: By the way. The C++ book I've quoted from twice just above looks really good so far. I've looked towards the back and it has a chapter on STL - it explains it very clearly. I've also read the first two chapters and they start a person off from square one and gradually lead him/her along.

I can't say much about the middle because I just bought the book a few days ago and haven't had a chance to read that part. But judging from the beginning and the ending, I'd say it's quite a good book for either an absolute beginner or an intermediate C++ programmer.

Progman
07-18-2003, 11:40 AM
Bjarne Stroustrup didn't always write about advanced C++; he had to have written books about beginning C++. People had to learn C++ after him right? At one point and time he was the only person who knew C++ so.......he had to teach other people somehow...with beginners books about C++

DNAunion2000
07-18-2003, 01:53 PM
Progman: Bjarne Stroustrup didn't always write about advanced C++; he had to have written books about beginning C++.

DNAunion: He didn't have to.

Stroustrup probably wasn't even interested in teaching complete newbies C++: he was probably interested in getting his peers to use it. And to do that does not require writing a beginner's book.

When invented, C++ was basically C with classes....in fact, that is what Stroustrup originally called it: "C with classes" (the term C++ came along later). So all his peers that already knew C just had to learn the object oriented aspects. In beginners books, the OOP discussion doesn't usually start until half way through the book. So Stroustrup could have written books that covered only that new part, which would not be for beginners.

Or, he could have relied upon his peers already knowing OOP from other languages. Thus, they'd already know C and OOP and Stroustrup would just need to write about the differences between the implementations of OOP in those other languages and in C++: again, not for a beginner.

(To make the point a different way, when Watson and Crick determined the double helical nature of DNA, they didn't have to write a beginner's book on the subject so that their peers could use that new-found knowledge: those who needed the new information already had all of the relevant background to understand it).

Now, whether or not Stroustrup actually did write any beginner's book is a different question than whether he HAD to. And on that point, all I can say is that the Stroustrup book I skimmed, and the Stroustrup book Robert Lafore's book comments about, were not for beginners.

One other point. If Stroustrup did write a beginner's book on C++ when the language first appeared, that book would be outdated anyway. C++ was created back in 1979 but wasn't standardized by ANSI/ISO until 1997. So any pre-1997 C++ book has the potential of being outdated.

imported_ExOdUs
07-18-2003, 03:36 PM
so what good book should i read cause i have learn c++ in 12 easy leassons and learn c++ in 21 days by jesse liberty are those good? cause i saw on a site that says they are not recommended

DNAunion2000
07-18-2003, 08:11 PM
Originally posted by ExOdUs
so what good book should i read cause i have learn c++ in 12 easy leassons and learn c++ in 21 days by jesse liberty are those good? cause i saw on a site that says they are not recommended

DNAunion: I don't think you should "stress out" over finding the perfect beginner's book too much. If you are new to programming and you have those two beginner's books, just read them and learn what you learn. I believe those two will teach the fundamentals just fine. If you later want to learn more advanced stuff, you can.

When I go into something new, I start off with the "Teach Yourself..." or "... For Dummies" types books. People really shouldn't knock them. Some are actually quite good, leading you from complete novice to ready-for-advanced-material competency in a short period of time.

sicarius
07-18-2003, 11:10 PM
Learning C prior to C++ is not, in my opinion, an inefficient method. The simple fact that most programmers will inevitably encounter BOTH languages should suggest that they would want to learn both.

C is to programming languages as VI is to editors. Just as you would be almost certain to find VI on any Unix like system, you would also be certain to find an implementation of C on any modern operating system.

Further more, as you pointed out in a previous post, a programmer that already knows C must only learn the differences between C and C++. This also helps if later on that same programmer needs to learn Objective-C, or any other future derivatives.

DNAunion2000
07-19-2003, 01:07 AM
Originally posted by sicarius
Learning C prior to C++ is not, in my opinion, an inefficient method. The simple fact that most programmers will inevitably encounter BOTH languages should suggest that they would want to learn both.

C is to programming languages as VI is to editors. Just as you would be almost certain to find VI on any Unix like system, you would also be certain to find an implementation of C on any modern operating system.

Further more, as you pointed out in a previous post, a programmer that already knows C must only learn the differences between C and C++. This also helps if later on that same programmer needs to learn Objective-C, or any other future derivatives.

DNAunion: I think their points were along the lines of the following:

1) I/O in C and C++ is different. C uses printf() and scanf() and format strings and you need to use the address-of operator with scanf(), while C++ uses cin and cout and i/o manipulators. And I/O is something that every program you write will do, probably multiple times. Spending so much time learning and "habitualizing" the C i/o methodology is a waste of time IF your goal is to learn C++.

2) The overall programming models for C and C++ are completely different. C divides everything up into functions that work on data: functions are the primary building blocks and data takes a backseat. C++ uses objects: encapsulations of data and code to model the world the way we view it. One can learn a bad habit by spending weeks or months learning to code everything as functions, then have to switch to thinking with an OOP mindset. Why not just start right off learning how to program objects?

In those senses, and possibly others, it is inefficient to learn C first, then move over to C++.

As an analogy...if two people are trying to get to Los Angeles, the one that is already in Seattle has a big advantage over the one in Miami...but why would someone starting in Miami drive to Seattle in order to get to LA?

nothing
07-19-2003, 01:30 AM
I'm reading this book called C++ How to Program, Fourth Edition by Deitel and I think it is a very nice book because I can understand everything.

DNAunion2000
07-19-2003, 11:36 AM
nothing: I'm reading this book called C++ How to Program, Fourth Edition by Deitel and I think it is a very nice book because I can understand everything.

DNAunion: Funny you should mention that book. Just a few days ago I wrote a "raving" review on it at Amazon.com.

Quite possibly the absolute best C++ book ever!
The book covers everything from the very simplest concepts (starting off with the standard "Hello World"-type program that explains that statements must end with semicolons, the use of curly braces, that every program starts execution at the main function, and so on) up to topics such as templates, pure virtual functions, polymorphism via base class pointers to derived classes, structured exception handling, and more.

One of the best things about this book is that it EXPLICITLY teaches you good programming practices, all the way through. Some C++ books meant for beginners try to teach you the language and don't even bother to try to teach you how to write programs correctly. Not this book. Time after time they tell you the proper method of writing code, as well as explaining why it should be done that way.

Also, the authors practice what they teach (and preach). For example, chapter "X" explains how to create templates, then when chapter "Y" creates a generic data structure, like a stack or queue, the authors do so using templates. Some other books teach you something in one chapter and then seem to forget it even exists.

Also, at least the version I have, comes with a Visual C++ 6.0 compiler (its a learning edition or something, not the full version. But who would expect that anyway?).

It's a pretty hefty price compared to many other C++ books. But, not trying to sound too much like an "infomercial", this is probably the only text you will ever need for C++ programming. So you save money by buying this one text instead of buying two or three that each does only a part of what this book does.

Oh, let me clarify something. This book does a pretty comprehensive coverage of ANSI/ISO Standard C++, the subject of the book. It does not teach C++ .NET (but, the same authors do have another book for that!).

Finally, I ran across this book when tutoring someone in a college C++ programming course. So even university professors recognize the worth of the text.

DNAunion: In fact, everyone who wrote reviews gave it 5 out of 5 stars: except one bozo (there's one in every crowd) who wrote a one-sentence dismissal and gave it one star, I think.

http://www.amazon.com/exec/obidos/tg/detail/-/0130384747/qid=1058624815/sr=8-1/ref=sr_8_1/002-3347961-9792031?v=glance&s=books&n=507846


The book is definitely one of the best C++ books around

However, I have found at least one or two of its more advanced discussions to be more "sophisticated" than other books: that is, less understandable for a beginner. For example, the STL (Standard Template Library) is covered very well, but I'm not sure that a beginner could pick it up easily: it might require extra effort. Now in the other book I've mentioned here, Object-Oriented Programming in C++ by Robert Lafore, the STL is covered very clearly (not that the second book is better than the first overall....I can't say that....but on this one point I find it the better).


***************************
EDITED: Looks like a couple others have thrown in very short dismissals of the book. Note though that one of them references the 3rd edition, not the fourth. A major overhaul occurred and this reviewer missed it. Another seemed to think that the Deitel's weren't "funny" enough or were too dry and professional. So? If you want humor, buy Dilbert. If you want to learn C++ programming, buy this book.

Both I and another reviewer pointed out that this text is used in our universities. Furthermore, another reviewer stated that this text was BETTER than the text he was using in his university.

Don't let the naysayers mislead you on this one!

sicarius
07-19-2003, 05:13 PM
My final point on all this is that the man that drives from Miami to Seatle on his way to LA would do so because he has then been to Seatle. You never know when you having been to Seatle will help.

I'm glad you found a book you like nothing. That, after all, is the most important part.

DNAunion2000
07-19-2003, 07:49 PM
DNAunion: I haven’t programmed in C for a decade, so some of the following may not be correct. However, most, if not all, of the following are “bad habits” one would learn by learning C first, then switching over to C++.

1) Output
C uses printf() with format strings. C++ uses cout and io manipulators

2) Input
C uses scanf() with the address-of operator. C++ uses cin

3) Variable declaration locations
In C, variables must be declared at the beginning of a function. In C++, variables can be declared just about anywhere, such as right before their first use

4) True/False
In C, there is no Boolean data type: programmers use integers (0 for false, any other, such as 1, for true). In Standard C++, there is a bool data type.

5) Namespaces
C does not use namespaces: C++ does.

6) Comments
C uses only /*…*/ comments: C++ usually uses single-line // comments

7) #include
To include a C header file you specify a “.h” extension: in C++ you usually don’t

8 ) String
C uses character arrays because it has no String data type: C++ has a String data type

9) #define
C uses #defines where C++ usually uses const variables instead

10) Macros
C uses macros whereas C++ usually uses inline functions

11) Paradigms
C is based on modular, structured programming: C++ is based on OOP

12) Structures
C structures can contain only data: C++ structures can contain both data and functions

13) Typedef/struct
In C, when declaring structure variables the programmer must specify struct (or use typedef when declaring the structure): in C++ structure variables are declared just like other variables

14) Enumerations
In C, when declaring enumeration variables the programmer must specify enum: in C++ enumeration variables are declared like other variables.

15) Classes
C does not have classes, encapsulation, inheritance, polymorphism: C++ has all of them

16) Templates
C does not have templates: C++ does.

17) STL
C does not have the STL: C++ does

sicarius
07-20-2003, 12:35 AM
I don't consider language features to be bad habits. These are mostly syntactic differences.

For example, keeping inheritance and polymorphism aside, calling a memeber function to perform an operation on an object instance is semantically no different from passing a pointer to a structure to a function that manipulates it.

In fact, using pragma and macros it is possible to write an OOP language write on top of C. Case in point is Objective-C.

This is my last point on this subject, as we are straying off topic.

DNAunion2000
07-20-2003, 02:40 AM
DNAunion: Forgot one.

18 ) References
C does not have references; C++ does

DNAunion2000
07-20-2003, 02:56 AM
DNAunion: Here’s the point. A person can read all of the beginner and intermediate books on C he/she wants, and he/she will never learn about and get a chance to use these important C++ “things”:

1) cout
2) cin
3) namespaces
4) bool data type
5) references
6) classes
7) encapsulation
8 ) inheritance
9) polymorphism
10) templates
11) Standard Template Library

In addition, moving from C to C++, a programmer may:

1) not take advantage of being able to declare variables in the middle of a function, just before their first use, because he/she always declared them at the beginning of functions while learning C: it became a “bad habit”

2) not take advantage of the C++ single line comments because he/she always used the multi-line C-style comments: they became a “bad habit”

3) continue to specify “.h” when including files, even though this is advised against in C++, because he/she always did it that way in C: it became a “bad habit”

etc.


If one’s goal is to learn C++, then the most efficient process is to learn C++, and not to first learn C and then switch over to learning C++.

Now, if that person runs across legacy C code, then he/she would already know a superset of C and should be able to work with it, or could THEN spend some time learning about it. But with C++ being the leader of the two, it pays to focus on it and to handle C as an exception.

Progman
07-23-2003, 02:25 PM
Dude, you really redeemed yourself by writing that novel about me being wrong about Stroustrup writting beginners C++ books.
I mean, Jesus Christ, you could have just said...no dude ur wrong he probably didn't write any beginners C++ books cause he was just trying to teach classes to his peers. But to write like 8 or 9 paragraphs...dude i get the point

DNAunion2000
07-23-2003, 09:24 PM
DNAunion: Progman, it wasn't anything personal. I have been told, both on the net and at work, that I am overly verbose. It is just my nature to write long-winded posts that try to cover every point, in detail, that comes up while I am writing.