Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

Sams Teach Yourself C++ in 21 Days (5th Edition) Paperback – Dec 14 2004

5 out of 5 stars 1 customer review

See all 2 formats and editions Hide other formats and editions
Amazon Price
New from Used from
Kindle Edition
"Please retry"
"Please retry"
CDN$ 135.51 CDN$ 44.79

There is a newer edition of this item:

Save an Additional 10% on Textbooks When you Join Amazon Student

No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.

  • Apple
  • Android
  • Windows Phone
  • Android

To get the free app, enter your e-mail address or mobile phone number.

Product Details

  • Paperback: 936 pages
  • Publisher: Sams Publishing; 5 edition (Dec 14 2004)
  • Language: English
  • ISBN-10: 0672327112
  • ISBN-13: 978-0672327117
  • Product Dimensions: 18.8 x 5.2 x 23.1 cm
  • Shipping Weight: 1.4 Kg
  • Average Customer Review: 5.0 out of 5 stars 1 customer review
  • Amazon Bestsellers Rank: #284,086 in Books (See Top 100 in Books)
  •  Would you like to update product info, give feedback on images, or tell us about a lower price?

  • See Complete Table of Contents

Product Description

From the Inside Flap


This book is designed to help you teach yourself how to program with C++. No one can learn a serious programming language in just three weeks, but each of the lessons in this book has been designed so that you can read the entire lesson in just a few hours on a single day.

In just 21 days, you'll learn about such fundamentals as managing input and output, loops and arrays, object-oriented programming, templates, and creating C++ applications—all in well-structured and easy-to-follow lessons. Lessons provide sample listings—complete with sample output and an analysis of the code—to illustrate the topics of the day.

To help you become more proficient, each lesson ends with a set of common questions and answers, a quiz, and exercises. You can check your progress by examining the quiz and exercise answers provided in Appendix D, "Answers."

Who Should Read This Book

You don't need any previous experience in programming to learn C++ with this book. This book starts you from the beginning and teaches you both the language and the concepts involved with programming C++. You'll find the numerous examples of syntax and detailed analysis of code an excellent guide as you begin your journey into this rewarding environment. Whether you are just beginning or already have some experience programming, you will find that this book's clear organization makes learning C++ fast and easy.

Conventions Used in This Book

Tip - These boxes highlight information that can make your C++ programming more efficient and effective.

Note - These boxes provide additional information related to material you just read.

FAQ - What do FAQs do?

Answer: These Frequently Asked Questions provide greater insight into the use of the language and clarify potential areas of confusion.

Caution - These focus your attention on problems or side effects that can occur in specific situations.


These boxes provide clear definitions of essential terms.

DO use the "Do/Don't" boxes to find a quick summary of a fundamental principle in a lesson.

DON'T overlook the useful information offered in these boxes.

This book uses various typefaces to help you distinguish C++ code from regular English. Actual C++ code is typeset in a special monospace font. Placeholders—words or characters temporarily used to represent the real words or characters you would type in code—are typeset in italic monospace. New or important terms are typeset in italic.

In the listings in this book, each real code line is numbered. If you see an unnumbered line in a listing, you'll know that the unnumbered line is really a continuation of the preceding numbered code line (some code lines are too long for the width of the book). In this case, you should type the two lines as one; do not divide them.Enter this book's ISBN (without the hyphens) in the Search box and click Search. When the book's title is displayed, click the title to go to a page where you can download the code and Appendix D.

© Copyright Pearson Education. All rights reserved.

From the Back Cover

Join the leagues of thousands of programmers and learn C++ from some of the best. The fifth edition of the best seller Sams Teach Yourself C++ in 21 Days, written by Jesse Liberty, a well-known C++ and C# programming manual author and Bradley L. Jones, manager for a number of high profiler developer websites, has been updated to the new ANSI/ISO C++ Standard. This is an excellent hands-on guide for the beginning programmer. Packed with examples of syntax and detailed analysis of code, fundamentals such as managing I/O, loops, arrays and creating C++ applications are all covered in the 21 easy-to-follow lessons. You will also be given access to a website that will provide you will all the source code examples developed in the book as a practice tool. C++ is the preferred language for millions of developers-make Sams Teach Yourself the preferred way to learn it!

See all Product Description

Inside This Book

(Learn More)
First Sentence
This book is designed to help you teach yourself how to program with C++. Read the first page
Explore More
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

5.0 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See the customer review
Share your thoughts with other customers

Top Customer Reviews

Format: Paperback
This is yet another fine book that I've added to my collection. I use it mainly as a reference but it is certainly an excellent teaching guide as well. This book is replete with informative lessons and practice exercises with answers for those who are new to the C ++ programming language. I would also highly recommend it for the intermediate level individuals who wish to augment their C++ programming skills. A thorough explanation precedes each exercise so the ease of learning progressively in as little time possible is greatly enhanced. The practice exercises are very helpful and practical. Expect to take more than 21 days to become proficient if you are just starting out in C++. Well done Jesse Liberty, Bradley Jones and everyone else involved in producing this book containing over 900 pages of excellent C++ training material!!
Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again.
Report abuse

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: HASH(0x9ecf9ee8) out of 5 stars 35 reviews
36 of 37 people found the following review helpful
HASH(0x9ed0d948) out of 5 stars Excellent Coverage, but examples can be rather bland... July 12 2006
By A. Eassa - Published on Amazon.com
Format: Paperback Verified Purchase
I've always been rather hesitant to read programming books with titles that imply a sacrifice of depth for gained ease in learning, but this book is a very well done and complete treatment of the fundamentals of the C++ language.

It assumes no previous knowledge -- just a willingness to learn. It begins with "Hello, World", the classic example first introduced in the K&R C book, and then continues for the next few "days" to cover the funamental C aspects such as basic I/O, variables, functions, branching, data types, and operators.

After that preliminary information is covered, the authors begin showing basic class useage -- the general form of a class, constructors, destructors, data members, and member functions.

In the final "day" of the "week", control statements (for, do...while, switch, etc.) are given a good, and thorough treatment.

The next "week" moves on to more advanced concepts such as pointers, reference variables, function overloading, inheritance, and polymorphism. By the end of this week, you will be pretty proficient, and probably ready to implement more substantial projects, however, the book still covers more.

In the last week, other, more advanced, concepts are introduced such as friend functions, file manipulation, low level bit manipulation, and a lot more to help you become a master of this beast of a language.

This book also goes through each and every example program and provides a thorough analysis -- so you're never left in the dark as to what a program is doing or how.

This work does have some shortcomings, but they're not that significant. Yes, some of the example programs are extremely boring and you're left thinking whether you should bother entering and compiling them. Sometimes explanations are offered for the most trivial of concepts in programs, but overall, it's a great book at a great price.

In short, if you want to learn C++ and you want to learn it thoroughly, then this is your book!
19 of 20 people found the following review helpful
HASH(0x9ed0dd74) out of 5 stars An interesting book overall Sept. 2 2005
By Panayotis Kalaitzoglou - Published on Amazon.com
Format: Paperback
Teach Yourself C++ in 21 days (Sams) is a quite good candidate for anyone looking for an introductory book on C++. It not only represents a smooth introduction to the language basics, but also offers valuable advice on good programming and design practices. I especially liked the Q&A section at the end of each chapter.

What differentiates it from similar introductory C++ books is the way the material is laid out. After covering the langugage syntax the authors try to put forward what they consider easier to understand. This makes it easier for the reader, although the book cannot be used as a reference.

There are numerous code examples, which are compact, well structured and easy to follow and understand.

However, there are a few things that I believe could definetely be improved. First and foremost templates and the STL are not covered until Day 19, which means that all the code samples until then use the old C libraries. My opinion is that since templates represent a whole new programming paradigm, they have to be introduced much earlier, although they can be a bit difficult to grasp. Not only that, but the code uses deprecated headers mixed with standard library headers (e.g. 13.12 - p.435, 13.7 - p.423); it is more natural to use <cstring> than <string.h> at least.

Also assertions should definetely be introduced earlier and used in the code samples.The custom string class bound checking should report error (assert) when out of bounds and not return the last element! (13.14 - p.437).

Moreover I consider function pointers a not so important topic to be covered on Day 15. I would prefer to see it in an Appendix, near deprecated features really. Chapter titles should probably be revised too. E.g. Day 16 is named "Advanced Inheritance", but aggregation which is covered there is not actually inheritance. The chapter would be better named "Other class relationships", or even better "Aggregation" and cover only aggregation.

I also believe it is important to pair each new() with a delete (e.g. 12.10 - p.398) even though the program ends. This is a very important programming habit that someone should get used to very early.

Overall I believe that this book, although it has some weak points, has much to offer to someone that starts learning C++.
21 of 23 people found the following review helpful
HASH(0x9ed0ddc8) out of 5 stars It's a Great Novel Aug. 3 2005
By Chris Kulhanek - Published on Amazon.com
Format: Paperback
Ok, I don't agree with the 1 star reviews, BUT, i have read better books. This book is meant to be read cover to cover. If you are looking to skim read, and get the bullet points and get going as fast as possible, then this is not your book. This book builds chapter by chapter, a lot of the same code is used across chapters with things being added each time. It's simple in nature and those of you that claim you know how to program and this book was worthless at explaining and left you confussed, I got news for you, you don't know how to program. This books is simple to read if you have ANY previous programming experience. If you have NONE, you are left lost. Go buy a book on just basic programming, i would not recommend c++. I give it 3 stars because all this book does is teach the basics of c++ syntax. It doesn't ever tie it all together and show you how to make a c++ project, which, when i got to the end, was what I wanted. I was left saying to myself, "ok, so show me how to use c++ pratically, in the real world." I never got that, all I could do was punch out meaningless c++ code. It explained every topic brought up very well though, no complaints. Java people will love this novel, they say to know one is to know 90% of the other.
7 of 7 people found the following review helpful
HASH(0x9f37a12c) out of 5 stars Recommended with caveats Dec 29 2007
By Alan Mead - Published on Amazon.com
Format: Paperback
I have programmed for years but never in a modern object-oriented language and I wish to maintain a C++ project. So I purchased this book. I also searched online for "C++ tutorials". In general, I think this book is OK.

Compared to online resources, this book provides a fuller and often deeper explanation of the basics of C++. Sometimes it was too much depth (e.g., showing a picture of a fence to explain the fence-post error was not particularly needed), but you can always skip the rest of the page. I think I gained a better understanding of the use inheritance, virtual methods, and polymorphism through Liberty's examples.

I can definitively deny other reviews of this book that suggest that Liberty uses older POD arrays of pchar/char... he uses strings except late in the course where he shows an implementation of a string class. One of the things I learned from the additional material in Liberty's book is why this is controversial and why "#include <string.h>" and "#include <string>" are different. (Liberty's is a modern, "#include <string>" book.)

The book is also full of code examples which are explained concisely (which is nice, after the first introduction of "#include <string>" you don't need the author to explain it each time). There is a degree of review and each chapter ends with "Q&A" (kind of a short FAQ for that chapter), a quiz and some exercises. The exercises are generally split between "do this" and "debug this" items. There are answers at the back of the book.

Finally, I think OOP requires new analysis and object design skills and on-line tutorials are mostly silent about this critical issue. Liberty provides one full chapter that is quite good at providing an overview (IMHO).

My main criticism is a matter of expectations; this book teaches you A LITTLE C++. The back of the book says "you'll have all the skills you need to BEGIN programming C++" (my emphasis). You still have a considerable learning curve as you master even intermediate aspects. A good example is implementing "one class per file". In passing on day 6 Liberty explains that he is NOT showing you the way professional C++ programmers write code and he provides a single and very incomplete example of splitting your work into multiple files. Working from this, I find that I do not understand namespaces well enough from the discussion on day 18 to work with multiple files.

Also, I noticed a few errors in the book. Unless I very misunderstand, inline class methods were mislabeled in Day 6 and the default value example was so unrealistic as to denigrate the topic (although Liberty nicely covers the debate over whether to use default values or simply overload a method/function).

And finally, I thought that almost no instruction on the toolsets (compiler, make, etc.) was limiting. Ultimately, this omission shows you how basic this book is but given the fundamental nature and the intended audience, I think it's really a glaring omission. That said, the bit of advice he does give is confined to Microsoft's Visual product which was completely unhelpful to me using g++.

So, I can recommend the book with these caveats. This book would be a great way to prepare for additional training or to equip you to ask slightly less ignorant questions in online forums.
7 of 8 people found the following review helpful
HASH(0x9f37a378) out of 5 stars Good Beginner C++ Book Nov. 11 2005
By buzz_coder - Published on Amazon.com
Format: Paperback
This book covers the fundamentals of standard c++ for the beginner very well and also provides a good guide for the more experienced programmer coming from another language who is wanting to learn c++.Well written in plain english and the example code is very clear and easy to follow.I would complement this text with another C++ book like Stephen Prata's C++ Primer Plus 5th Edition or Ivor Horton's Beginning Ansi C++ The Complete language to get a complete picture of the standard language.