Programming Books C Java PHP Python Learn more Browse Programming Books
C++ Primer Plus (5th Edition) and over one million other books are available for Amazon Kindle. Learn more

Sorry, this item is not available in
Image not available for
Color:
Image not available

To view this video download Flash Player

 
Have one to sell? Sell yours here
Start reading C++ Primer Plus (5th Edition) on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

C++ Primer Plus (5th Edition) [Paperback]

by Stephen Prata
4.7 out of 5 stars  See all reviews (97 customer reviews)


Available from these sellers.


Free Two-Day Shipping for College Students with Amazon Student

Formats

Amazon Price New from Used from
Kindle Edition $27.49  
Paperback --  
Sell Us Your Books
Get up to 80% back when you sell us your books, even if you didn't buy them at Amazon. Learn more
There is a newer edition of this item:
C++ Primer Plus (6th Edition) (Developer's Library) C++ Primer Plus (6th Edition) (Developer's Library) 4.4 out of 5 stars (64)
$31.26
In Stock.

Book Description

November 25, 2004 0672326973 978-0672326974 5

If you are new to C++ programming, C++ Primer Plus, Fifth Edition is a friendly and easy-to-use self-study guide. You will cover the latest and most useful language enhancements, the Standard Template Library and ways to streamline object-oriented programming with C++. This guide also illustrates how to handle input and output, make programs perform repetitive tasks, manipulate data, hide information, use functions and build flexible, easily modifiable programs. With the help of this book, you will:

  • Learn C++ programming from the ground up.
  • Learn through real-world, hands-on examples.
  • Experiment with concepts, including classes, inheritance, templates and exceptions.
  • Reinforce knowledge gained through end-of-chapter review questions and practice programming exercises.

C++ Primer Plus, Fifth Edition makes learning and using important object-oriented programming concepts understandable. Choose this classic to learn the fundamentals and more of C++ programming.


 



Editorial Reviews

About the Author

Stephen Prata teaches astronomy, physics, and computer science at the College of Marin in Kentfield, California. He received his B.S. from the California Institute of Technology and his Ph.D. from the University of California, Berkeley. Stephen has authored or coauthored more than a dozen books for The Waite Group. He wrote The Waite Group's New C Primer Plus, which received the Computer Press Association's 1990 Best How-to Computer Book Award, and The Waite Group's C++ Primer Plus, nominated for the Computer Press Association's Best How-to Computer Book Award in 1991.

Excerpt. © Reprinted by permission. All rights reserved.

Introduction: C++ Primer Plus

Introduction

Preface to the Fifth Edition

Learning C++ is an adventure of discovery, particularly because the language accommodates several programming paradigms, including object-oriented programming, generic programming, and the traditional procedural programming. C++ was a moving target as the language added new features, but now, with the ISO/ANSI C++ Standard, Second Edition (2003), in place, the language has stabilized. Contemporary compilers support most or all of the features mandated by the standard, and programmers have had time to get used to applying these features. The fifth edition of this book, C++ Primer Plus, reflects the ISO/ANSI standard and describes this matured version of C++.

C++ Primer Plus discusses the basic C language and presents C++ features, making this book self-contained. It presents C++ fundamentals and illustrates them with short, to-the-point programs that are easy to copy and experiment with. You'll learn about input/output (I/O), how to make programs perform repetitive tasks and make choices, the many ways to handle data, and how to use functions. You'll learn about the many features C++ has added to C, including the following:

  • Classes and objects

  • Inheritance

  • Polymorphism, virtual functions, and runtime type identification (RTTI)

  • Function overloading

  • Reference variables

  • Generic, or type-independent, programming, as provided by templates and the Standard Template Library (STL)

  • The exception mechanism for handling error conditions

  • Namespaces for managing names of functions, classes, and variables

The Primer Approach

C++ Primer Plus brings several virtues to the task of presenting all this material. It builds on the primer tradition begun by C Primer Plus nearly two decades ago and embraces its successful philosophy:

  • A primer should be an easy-to-use, friendly guide.

  • A primer doesn't assume that you are already familiar with all relevant programming concepts.

  • A primer emphasizes hands-on learning with brief, easily typed examples that develop your understanding, a concept or two at a time.

  • A primer clarifies concepts with illustrations.

  • A primer provides questions and exercises to let you test your understanding, making the book suitable for self-learning or for the classroom.

Following these principles, the book helps you understand this rich language and how to use it. For example:

  • It provides conceptual guidance about when to use particular features, such as using public inheritance to model what are known as is-a relationships.

  • It illustrates common C++ programming idioms and techniques.

  • It provides a variety of sidebars, including tips, cautions, things to remember, compatibility notes, and real-world notes.

The author and editors of this book do our best to keep the presentation to-the-point, simple, and fun. Our goal is that by the end of the book, you'll be able to write solid, effective programs and enjoy yourself doing so.

Sample Code Used in This Book

This book provides an abundance of sample code, most of it in the form of complete programs. Like the previous editions, this book practices generic C++ so that it is not tied to any particular kind of computer, operating system, or compiler. Thus, the examples were tested on a Windows XP system, a Macintosh OS X system, and a Linux system. Only a few programs were affected by compiler non-conformance issues. Compiler compliance with the C++ standard has improved since the previous edition of this book first appeared.

The sample code for the complete programs described in this book is available on the Sams website, at http://www.samspublishing.com. 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. You also can find solutions to selected programming exercises at this site.

How This Book Is Organized

This book is divided into 17 chapters and 10 appendixes, summarized here.

Chapter 1: Getting Started

Chapter 1 relates how Bjarne Stroustrup created the C++ programming language by adding object-oriented programming support to the C language. You'll learn the distinctions between procedural languages, such as C, and object-oriented languages, such as C++. You'll read about the joint ANSI/ISO work to develop a C++ standard. This chapter discusses the mechanics of creating a C++ program, outlining the approach for several current C++ compilers. Finally, it describes the conventions used in this book.

Chapter 2: Setting Out to C++

Chapter 2 guides you through the process of creating simple C++ programs. You'll learn about the role of the main() function and about some of the kinds of statements that C++ programs use. You'll use the predefined cout and cin objects for program output and input, and you'll learn about creating and using variables. Finally, you'll be introduced to functions, C++'s programming modules.

Chapter 3: Dealing with Data

C++ provides built-in types for storing two kinds of data: integers (numbers with no fractional parts) and floating-point numbers (numbers with fractional parts). To meet the diverse requirements of programmers, C++ offers several types in each category. Chapter 3 discusses those types, including creating variables and writing constants of various types. You'll also learn how C++ handles implicit and explicit conversions from one type to another.

Chapter 4: Compound Types

C++ lets you construct more elaborate types from the basic built-in types. The most advanced form is the class, discussed in Chapters 9 through 13. Chapter 4 discusses other forms, including arrays, which hold several values of a single type; structures, which hold several values of unlike types; and pointers, which identify locations in memory. You'll also learn how to create and store text strings and to handle text I/O by using C-style character arrays and the C++ string class. Finally, you'll learn some of the ways C++ handles memory allocation, including using the new and delete operators for managing memory explicitly.

Chapter 5: Loops and Relational Expressions

Programs often must perform repetitive actions, and C++ provides three looping structures for that purpose: the for loop, the while loop, and the do while loop. Such loops must know when they should terminate, and the C++ relational operators enable you to create tests to guide such loops. In Chapter 5 you learn how to create loops that read and process input character-by-character. Finally, you'll learn how to create two-dimensional arrays and how to use nested loops to process them.

Chapter 6: Branching Statements and Logical Operators

Programs can behave intelligently if they can tailor their behavior to circumstances. In Chapter 6 you'll learn how to control program flow by using the if, if else, and switch statements and the conditional operator. You'll learn how to use logical operators to help express decision-making tests. Also, you'll meet the cctype library of functions for evaluating character relations, such as testing whether a character is a digit or a nonprinting character. Finally, you'll get an introductory view of file I/O.

Chapter 7: Functions: C++'s Programming Modules

Functions are the basic building blocks of C++ programming. Chapter 7 concentrates on features that C++ functions share with C functions. In particular, you'll review the general format of a function definition and examine how function prototypes increase the reliability of programs. Also, you'll investigate how to write functions to process arrays, character strings, and structures. Next, you'll learn about recursion, which is when a function calls itself, and see how it can be used to implement a divide-and-conquer strategy. Finally, you'll meet pointers to functions, which enable you to use a function argument to tell one function to use a second function.

Chapter 8: Adventures in Functions

Chapter 8 explores the new features C++ adds to functions. You'll learn about inline functions, which can speed program execution at the cost of additional program size. You'll work with reference variables, which provide an alternative way to pass information to functions. Default arguments let a function automatically supply values for function arguments that you omit from a function call. Function overloading lets you create functions having the same name but taking different argument lists. All these features have frequent use in class design. Also, you'll learn about function templates, which allow you to specify the design of a family of related functions.

Chapter 9: Memory Models and Namespaces

Chapter 9 discusses putting together multifile programs. It examines the choices in allocating memory, looking at different methods of managing memory and at scope, linkage, and namespaces, which determine what parts of a program know about a variable.

Chapter 10: Objects and Classes

A class is a user-defined type, and an object (such as a variable) is an instance of a class. Chapter 10 introduces you to object-oriented programming and to class design. A class declaration describes the information stored in a class object and also the operations (class methods) allowed for class objects. Some parts of an object are visible to the outside world (the public portion), and some are hidden ...


Product Details

  • Paperback: 1224 pages
  • Publisher: Sams; 5 edition (November 25, 2004)
  • Language: English
  • ISBN-10: 0672326973
  • ISBN-13: 978-0672326974
  • Product Dimensions: 9 x 7.3 x 1.5 inches
  • Shipping Weight: 4.4 pounds
  • Average Customer Review: 4.7 out of 5 stars  See all reviews (97 customer reviews)
  • Amazon Best Sellers Rank: #180,610 in Books (See Top 100 in Books)

More About the Author

Discover books, learn about writers, read author blogs, and more.

Customer Reviews

Most Helpful Customer Reviews
147 of 152 people found the following review helpful
5.0 out of 5 stars The first c++ book you should read February 16, 2007
By T. Liu
Format:Paperback|Verified Purchase
If you are new to C++, this is THE C++ you need to read. There is another book called "C++ Primer" (no plus). The following comment is what I wrote for the book C++ Primer, which may give you some idea of the difference between these two:

This is a great book for anyone who want to enhance his/her knowledge

on C++, but this is by no means a primer book. If you are new to C++,

read the book "C++ primer plus" first. It is so funny that the book

"C++ primer plus" (which is also a great book) is really an introductory

book. The names of these two books should be swapped because C++ Primer

introduces more advanced topics and the topics that an experience programmer should know but a student does not need to. From my teaching experience in a state university, I would suggest students to read C++ books in the following order:

C++ primer Plus

C++ Primer

Thinking in C++ (great book, free on the internet)

The C++ Programming Language (by Stroustrup)

Then you may want to read some books on special topics such as Visual C++, Database, etc.
Was this review helpful to you?
178 of 189 people found the following review helpful
Format:Paperback
Stephen Prata: give the man a cheer (beer!) (or many)! This book is good...no, not good...GREAT! A book doesn't last 20 years (yes, 20) through various editions (5 obviously) without being something special. And this is no exception. This is unqeustionably the best beginner/intermediate book on C++ I have ever read (it pains me to say it...but it has dethroned Object oriented programming in c++ by Lafore, ISBN 0672323087 in that respect). Maybe it's just me, but Prata has a tone (a way) that just makes it VERY easy to relate to the concepts he is trying to explain. He doesn't belabor a point, nor does he treat you like a gumby or one of his colleagues to impress with his knowledge of the arcana of C++. He, oddly enough, seems more interested in teaching you (properly) then trying to get paid (look at the size of the book! if he were looking to get paid, cut the book in half, sell it in two parts or sell one reduced size part for the same price).

Prata offers fair coverage of the language: particularly the basics, as well as some nice software engineering opinions along the way (not in little colored boxes like Deitel with an Ant picture...which is cool: the ant analogy just annoys me- loss of identity, no individuality, part of a hive, etc...). Obviously he can't cover everything. Check out the chapter listing to see if he has what you want! But what he does cover-> the ++basics are extremely well done. There are programming exercises at the end of each chapter of course (with answers).

Prata has adopted a friendly, welcoming tone, laced with humor (not insipid humor, or just plain lame). He doesn't lambast microsoft or push any particular product/compiler. He provides little tips if you're using new or old, non-ansi-c++ compliant compilers.
Read more ›
Was this review helpful to you?
76 of 79 people found the following review helpful
5.0 out of 5 stars Top marks all around April 6, 2005
By Adaera
Format:Paperback
The decorously named "C++ Primer Plus, fifth edition" is a book for C++ beginners and those who would consider themselves a C++ virtuoso. C++ Primer Plus doesn't follow the trend of being the type of programming book that you either learn from and set away forever on a dusty shelf nor the type that you can use as a reference guide but can't use it to learn from. This is one of the few programming books I have read that I have both learned from and can still use as a perfectly suitable reference guide.

In C++ Primer Plus, you are lead through the "cin's" and "cout's" of C++. In this book you will be given well guided lessons with examples from the basic to the advanced features of this wonderfuly capable programming language. You will learn the common C++ programming idioms and techniques as you turn the pages, each example constructed clearly and professionally. One of the great features attributed to this book is the dedication to teaching its readers C++, one being each example code given to you to
use was carefully crafted to be compitable with most popular and even a few less heard of, C++ compilers.
The author is also good at explaining each piece of code with wonderful precision and patience, so well in fact they don't have to provide constant screen shots to show what they are trying to explain - unlike many other programming books.
If you have ever wanted to learn a programming language that is greatly respected in the business world, then I would of course suggest picking up C++. If you want a great book to learn from and use as a guide throughout your programming life for C++, then I suggest picking up "C++ Primer Plus, fifth edition".
Read more ›
Comment | 
Was this review helpful to you?
38 of 40 people found the following review helpful
5.0 out of 5 stars The definite book for beginners April 14, 2006
By XFatMan
Format:Paperback|Verified Purchase
I'm a very picky kind of guy when it comes to buying books on programming. To see what I think of this book, you should read my little story.

When I entered the wonderful world of programming, I chose Visual Basic .NET. This language was famous for being easy to learn. What I didn't know was that it had grown into something more complex, and .NET is a bit tougher to learn than any of the previous versions. So I thought it would only be natural that I needed to buy a couple of books to master the language.

The more books I bought, the more I got sick and tired of authors who weren't able to follow simple naming conventions. Another annoying thing with .NET books is that you can find one sentence in almost all of them saying, "You don't need to know this" when it comes to using built-in functions. Whether I need to know something or not is my decision, not the author's decision. So the author's job is to explain it, and if I really "don't need to know it", I can skip the section. But to make matters worse, most authors didn't even switch to .NET and continued writing bad code as they did with previous versions of Visual Basic, which has nothing to do with .NET. In consequence, I switched to C#, hoping that things would get better.

After the switch, I could still use my Visual Basic .NET books because the syntax is so similar. But I decided to buy some C# books since I hoped that quality would get better. In fact, quality did get much better. But another problem was still the same: most beginning .NET books are too trivial, too superficial, and too incomplete. For a good start with .NET, you need quite a couple of books. The nine books on .NET I own range from beginner topics to advanced topics, but I still find it's incomplete and much too superficial.
Read more ›
Was this review helpful to you?
Most Recent Customer Reviews
4.0 out of 5 stars Satisified
The book was a little damage from looking like it was dropped. No bends or tears. Overall, book was as described.
Published 1 month ago by Jerhemy Waldon
5.0 out of 5 stars Really good C++ book
One of the best c++ books i've read. There is alot of information and I would recommend this for a beginner
Published 4 months ago by Ickdeep Singh
5.0 out of 5 stars C++ as an intellectual pursuit
anyone interested in C++ programming, will undoubtedly find a myriad of books each giving their rendition, version, and approach to this enthralling subject.. Read more
Published 11 months ago by Chuck
5.0 out of 5 stars Thank you. Thank you. Thank you.
If you really want to understand what happens under the hood and how to properly code C++ than this book is for you. Read more
Published 12 months ago by JJ
5.0 out of 5 stars SO AWESOME!
This book is RIDICULOUS! I LOVE programming because of this book. If you've never typed a word of code in your life or if you've got three other languages under your belt you will... Read more
Published 14 months ago by Kpen
5.0 out of 5 stars Best C++ Book Out There
This is by far the best C++ book out there.

I studied C++, Java, Pascal, Basic, etc. back in highschool. Read more
Published 21 months ago by Hideo Kuze
5.0 out of 5 stars This Book Changed My Outlook On Life
Steven Prata is a genius. With the code examples and fine attention to detail with a "Try-It-Yourself" approach, one cannot read through the text without gaining vast knowledge of... Read more
Published 21 months ago by Little Commandlet
5.0 out of 5 stars Best primer available for learning programming
Why would I call "C++ Primer Plus" the best primer available? I have read the start of perhaps 50 programming books (closer to 100). Read more
Published 22 months ago by M. C. Malkemus
5.0 out of 5 stars By far the most straight-forward explanation of C++ I've seen
I've have been learning C++ off-and-on for years, and have read probably a half dozen books on C++. Most other books with tell you a few basic things, but never explain the details... Read more
Published on February 9, 2012 by A. M. Hernandez
5.0 out of 5 stars Great!
I've read a lot of books on many languages - Perl, Tcl/tk, Python, most from O'Reilly. This book is so thorough in it's introduction to the language it's amazing. Read more
Published on December 2, 2011 by d
Search Customer Reviews
Only search this product's reviews
ARRAY(0x9f02ff0c)




What Other Items Do Customers Buy After Viewing This Item?


Forums

Topic From this Discussion
Is there going to be a 6th edition?
Yes, February 2010
Aug 10, 2009 by A. Armbruster |  See all 9 posts
Have something you'd like to share about this product?
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Search Customer Discussions
Search all Amazon discussions


Look for Similar Items by Category