Home > Store

C++ Primer, 5th Edition

Register your product to gain access to bonus material or receive a coupon.

C++ Primer, 5th Edition

Best Value Purchase

Book + eBook Bundle

  • Your Price: $76.29
  • List Price: $127.98
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

More Purchase Options

Book

  • Your Price: $55.99
  • List Price: $69.99
  • Usually ships in 24 hours.

eBook (Watermarked)

  • Your Price: $46.39
  • List Price: $57.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

About

Features

  • A best-seller completely revised and rewritten for the new C++ 2011 standard
  • A favorite choice for a first C++ book--greatly improved and updated for modern C++ programming.
  • Reorganized to better address the novice audience, making it more approachable for non-C programmers.
  • Features many new examples that are less advanced and more accessible to novices as well as experienced programmers--folks who already use C++ need this book too.

Description

  • Copyright 2013
  • Dimensions: 7" x 9-1/8"
  • Pages: 976
  • Edition: 5th
  • Book
  • ISBN-10: 0-321-71411-3
  • ISBN-13: 978-0-321-71411-4

Bestselling Programming Tutorial and Reference Completely Rewritten for the New C++11 Standard

Fully updated and recast for the newly released C++11 standard, this authoritative and comprehensive introduction to C++ will help you to learn the language fast, and to use it in modern, highly effective ways. Highlighting today’s best practices, the authors show how to use both the core language and its standard library to write efficient, readable, and powerful code.

C++ Primer, Fifth Edition, introduces the C++ standard library from the outset, drawing on its common functions and facilities to help you write useful programs without first having to master every language detail. The book’s many examples have been revised to use the new language features and demonstrate how to make the best use of them. This book is a proven tutorial for those new to C++, an authoritative discussion of core C++ concepts and techniques, and a valuable resource for experienced programmers, especially those eager to see C++11 enhancements illuminated.

Start Fast and Achieve More

  • Learn how to use the new C++11 language features and the standard library to build robust programs quickly, and get comfortable with high-level programming
  • Learn through examples that illuminate today’s best coding styles and program design techniques
  • Understand the “rationale behind the rules”: why C++11 works as it does
  • Use the extensive crossreferences to help you connect related concepts and insights
  • Benefit from up-to-date learning aids and exercises that emphasize key points, help you to avoid pitfalls, promote good practices, and reinforce what you’ve learned

Access the source code for the extended examples from informit.com/title/0321714113

C++ Primer, Fifth Edition, features an enhanced, layflat binding, which allows the book to stay open more easily when placed on a flat surface. This special binding method—notable by a small space inside the spine—also increases durability.

Downloads

Downloads

Download the source files for GCC 4.7.0.

Download the source code files for MS Visual Studio 2012

Download the source code files for GCC pre-C++ 11 compilers 2012.

Download the source code files for Microsoft pre-C++ 11 compilers.

Sample Content

Online Sample Chapter

Working with Dynamic Memory in C++

Sample Pages

Download the sample pages (includes Chapter 12 and Index)

Table of Contents

Preface xxiii

Chapter 1: Getting Started 1

1.1 Writing a Simple C++ Program 2

1.2 A First Look at Input/Output 5

1.3 A Word About Comments 9

1.4 Flow of Control 11

1.5 Introducing Classes 19

1.6 The Bookstore Program 24

Chapter Summary 26

Defined Terms 26

Part I: The Basics 29

Chapter 2: Variables and Basic Types 31

2.1 Primitive Built-in Types 32

2.2 Variables 41

2.3 Compound Types 50

2.4 const Qualifier 59

2.5 Dealing with Types 67

2.6 Defining Our Own Data Structures 72

Chapter Summary 78

Defined Terms 78

Chapter 3: Strings, Vectors, and Arrays 81

3.1 Namespace using Declarations 82

3.2 Library string Type 84

3.3 Library vector Type 96

3.4 Introducing Iterators 106

3.5 Arrays 113

3.6 Multidimensional Arrays 125

Chapter Summary 131

Defined Terms 131

Chapter 4: Expressions 133

4.1 Fundamentals 134

4.2 Arithmetic Operators 139

4.3 Logical and Relational Operators 141

4.4 Assignment Operators 144

4.5 Increment and Decrement Operators 147

4.6 The Member Access Operators 150

4.7 The Conditional Operator 151

4.8 The Bitwise Operators 152

4.9 The sizeof Operator 156

4.10 Comma Operator 157

4.11 Type Conversions 159

4.12 Operator Precedence Table 166

Chapter Summary 168

Defined Terms 168

Chapter 5: Statements 171

5.1 Simple Statements 172

5.2 Statement Scope 174

5.3 Conditional Statements 174

5.4 Iterative Statements 183

5.5 Jump Statements 190

5.6 try Blocks and Exception Handling 193

Chapter Summary 199

Defined Terms 199

Chapter 6: Functions 201

6.1 Function Basics 202

6.2 Argument Passing 208

6.3 Return Types and the return Statement 222

6.4 Overloaded Functions 230

6.5 Features for Specialized Uses 236

6.6 Function Matching 242

6.7 Pointers to Functions 247

Chapter Summary 251

Defined Terms 251

Chapter 7: Classes 253

7.1 Defining Abstract Data Types 254

7.2 Access Control and Encapsulation 268

7.3 Additional Class Features 271

7.4 Class Scope 282

7.5 Constructors Revisited 288

7.6 static Class Members 300

Chapter Summary 305

Defined Terms 305

Part II: The C++ Library 307

Chapter 8: The IO Library 309

8.1 The IO Classes 310

8.2 File Input and Output 316

8.3 string Streams 321

Chapter Summary 324

Defined Terms 324

Chapter 9: Sequential Containers 325

9.1 Overview of the Sequential Containers 326

9.2 Container Library Overview 328

9.3 Sequential Container Operations 341

9.4 How a vector Grows 355

9.5 Additional string Operations 360

9.6 Container Adaptors 368

Chapter Summary 372

Defined Terms 372

Chapter 10: Generic Algorithms 375

10.1 Overview 376

10.2 A First Look at the Algorithms 378

10.3 Customizing Operations 385

10.4 Revisiting Iterators 401

10.5 Structure of Generic Algorithms 410

10.6 Container-Specific Algorithms 415

Chapter Summary 417

Defined Terms 417

Chapter 11: Associative Containers 419

11.1 Using an Associative Container 420

11.2 Overview of the Associative Containers 423

11.3 Operations on Associative Containers 428

11.4 The Unordered Containers 443

Chapter Summary 447

Defined Terms 447

Chapter 12: Dynamic Memory 449

12.1 Dynamic Memory and Smart Pointers 450

12.2 Dynamic Arrays 476

12.3 Using the Library: A Text-Query Program 484

Chapter Summary 491

Defined Terms 491

Part III: Tools for Class Authors 493

Chapter 13: Copy Control 495

13.1 Copy, Assign, and Destroy 496

13.2 Copy Control and Resource Management 510

13.3 Swap 516

13.4 A Copy-Control Example 519

13.5 Classes that Manage Dynamic Memory 524

13.6 Moving Objects 531

Chapter Summary 549

Defined Terms 549

Chapter 14: Overloaded Operations and Conversions 551

14.1 Basic Concepts 552

14.2 Input and Output Operators 556

14.3 Arithmetic and Relational Operators 560

14.4 Assignment Operators 563

14.5 Subscript Operator 564

14.6 Increment and Decrement Operators 566

14.7 Member Access Operators 569

14.8 Function-Call Operator 571

14.9 Overloading, Conversions, and Operators 579

Chapter Summary 590

Defined Terms 590

Chapter 15: Object-Oriented Programming 591

15.1 OOP: An Overview 592

15.2 Defining Base and Derived Classes 594

15.3 Virtual Functions 603

15.4 Abstract Base Classes 608

15.5 Access Control and Inheritance 511

15.6 Class Scope under Inheritance 617

15.7 Constructors and Copy Control 622

15.8 Containers and Inheritance 630

15.9 Text Queries Revisited 634

Chapter Summary 649

Defined Terms 649

Chapter 16: Templates and Generic Programming 651

16.1 Defining a Template 652

16.2 Template Argument Deduction 678

16.3 Overloading and Templates 694

16.4 Variadic Templates 699

16.5 Template Specializations 706

Chapter Summary 713

Defined Terms 713

Part IV: Advanced Topics 715

Chapter 17: Specialized Library Facilities 717

17.1 The tuple Type 718

17.2 The bitset Type 723

17.3 Regular Expressions 728

17.4 Random Numbers 745

17.5 The IO Library Revisited 752

Chapter Summary 769

Defined Terms 769

Chapter 18: Tools for Large Programs 771

18.1 Exception Handling 772

18.2 Namespaces 785

18.3 Multiple and Virtual Inheritance 802

Chapter Summary 816

Defined Terms 816

Chapter 19: Specialized Tools and Techniques 819

19.1 Controlling Memory Allocation 820

19.2 Run-Time Type Identification 825

19.3 Enumerations 832

19.4 Pointer to Class Member 835

19.5 Nested Classes 843

19.6 Union: A Space-Saving Class 847

19.7 Local Classes 852

19.8 Inherently Nonportable Features 854

Chapter Summary 862

Defined Terms 862

Appendix A: The Library 865

A.1 Library Names and Headers 866

A.2 A Brief Tour of the Algorithms 870

A.3 Random Numbers 882

Index 887

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020