Programming: Principles and Practice Using C++, 3rd Edition

Book description

An Introduction to Programming by the Inventor of C++

Programming: Principles and Practice Using C++, Third Edition, will help anyone who is willing to work hard learn the fundamental principles of programming and develop the practical skills needed for programming in the real world. Previous editions have been used successfully by many thousands of students. This revised and updated edition

  • Assumes that your aim is to eventually write programs that are good enough for others to use and maintain

  • Focuses on fundamental concepts and techniques, rather than on obscure language-technical details

  • Is an introduction to programming in general, including procedural, object-oriented, and generic programming, rather than just an introduction to a programming language

  • Covers both contemporary high-level techniques and the lower-level techniques needed for efficient use of hardware

  • Will give you a solid foundation for writing useful, correct, type-safe, maintainable, and efficient code

  • Is primarily designed for people who have never programmed before, but even seasoned programmers have found previous editions useful as an introduction to more effective concepts and techniques

  • Covers a wide range of essential concepts, design and programming techniques, language features, and libraries

  • Uses contemporary C++ (C++20 and C++23)

  • Covers the design and use of both built-in types and user-defi ned types, complete with input, output, computation, and simple graphics/GUI

  • Offers an introduction to the C++ standard library containers and algorithms

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.

Table of contents

  1. Cover Page
  2. About This eBook
  3. Title Page
  4. Copyright Page
  5. Contents
  6. Preface
    1. Previous Editions
    2. Acknowledgments
  7. 0. Notes to the Reader
    1. 0.1 The structure of this book
    2. 0.2 A philosophy of teaching and learning
    3. 0.3 ISO standard C++
    4. 0.4 PPP support
    5. 0.5 Author biography
    6. 0.6 Bibliography
  8. Part I: The Basics
    1. 1. Hello, World!
      1. 1.1 Programs
      2. 1.2 The classic first program
      3. 1.3 Compilation
      4. 1.4 Linking
      5. 1.5 Programming environments
    2. 2. Objects, Types, and Values
      1. 2.1 Input
      2. 2.2 Variables
      3. 2.3 Input and type
      4. 2.4 Operations and operators
      5. 2.5 Assignment and initialization
      6. 2.6 Names
      7. 2.7 Types and objects
      8. 2.8 Type safety
      9. 2.9 Conversions
      10. 2.10 Type deduction: auto
    3. 3. Computation
      1. 3.1 Computation
      2. 3.2 Objectives and tools
      3. 3.3 Expressions
      4. 3.4 Statements
      5. 3.5 Functions
      6. 3.6 vector
      7. 3.7 Language features
    4. 4. Errors!
      1. 4.1 Introduction
      2. 4.2 Sources of errors
      3. 4.3 Compile-time errors
      4. 4.4 Link-time errors
      5. 4.5 Run-time errors
      6. 4.6 Exceptions
      7. 4.7 Avoiding and finding errors
    5. 5. Writing a Program
      1. 5.1 A problem
      2. 5.2 Thinking about the problem
      3. 5.3 Back to the calculator!
      4. 5.4 Back to the drawing board
      5. 5.5 Turning a grammar into code
      6. 5.6 Trying the first version
      7. 5.7 Trying the second version
      8. 5.8 Token streams
      9. 5.9 Program structure
    6. 6. Completing a Program
      1. 6.1 Introduction
      2. 6.2 Input and output
      3. 6.3 Error handling
      4. 6.4 Negative numbers
      5. 6.5 Remainder: %
      6. 6.6 Cleaning up the code
      7. 6.7 Recovering from errors
      8. 6.8 Variables
    7. 7. Technicalities: Functions, etc.
      1. 7.1 Technicalities
      2. 7.2 Declarations and definitions
      3. 7.3 Scope
      4. 7.4 Function call and return
      5. 7.5 Order of evaluation
      6. 7.6 Namespaces
      7. 7.7 Modules and headers
    8. 8. Technicalities: Classes, etc.
      1. 8.1 User-defined types
      2. 8.2 Classes and members
      3. 8.3 Interface and implementation
      4. 8.4 Evolving a class: Date
      5. 8.5 Enumerations
      6. 8.6 Operator overloading
      7. 8.7 Class interfaces
  9. Part II: Input and Output
    1. 9. Input and Output Streams
      1. 9.1 Input and output
      2. 9.2 The I/O stream model
      3. 9.3 Files
      4. 9.4 I/O error handling
      5. 9.5 Reading a single value
      6. 9.6 User-defined output operators
      7. 9.7 User-defined input operators
      8. 9.8 A standard input loop
      9. 9.9 Reading a structured file
      10. 9.10 Formatting
      11. 9.11 String streams
    2. 10. A Display Model
      1. 10.1 Why graphics?
      2. 10.2 A display model
      3. 10.3 A first example
      4. 10.4 Using a GUI library
      5. 10.5 Coordinates
      6. 10.6 Shapes
      7. 10.7 Using Shape primitives
      8. 10.8 Getting the first example to run
    3. 11. Graphics Classes
      1. 11.1 Overview of graphics classes
      2. 11.2 Point and Line
      3. 11.3 Lines
      4. 11.4 Color
      5. 11.5 Line_style
      6. 11.6 Polylines
      7. 11.7 Closed shapes
      8. 11.8 Text
      9. 11.9 Mark
      10. 11.10 Image
    4. 12. Class Design
      1. 12.1 Design principles
      2. 12.2 Shape
      3. 12.3 Base and derived classes
      4. 12.4 Other Shape functions
      5. 12.5 Benefits of object-oriented programming
    5. 13. Graphing Functions and Data
      1. 13.1 Introduction
      2. 13.2 Graphing simple functions
      3. 13.3 Function
      4. 13.4 Axis
      5. 13.5 Approximation
      6. 13.6 Graphing data
    6. 14. Graphical User Interfaces
      1. 14.1 User-interface alternatives
      2. 14.2 The “Next” button
      3. 14.3 A simple window
      4. 14.4 Button and other Widgets
      5. 14.5 An example: drawing lines
      6. 14.6 Simple animation
      7. 14.7 Debugging GUI code
  10. Part III: Data and Algorithms
    1. 15. Vector and Free Store
      1. 15.1 Introduction
      2. 15.2 vector basics
      3. 15.3 Memory, addresses, and pointers
      4. 15.4 Free store and pointers
      5. 15.5 Destructors
      6. 15.6 Access to elements
      7. 15.7 An example: lists
      8. 15.8 The this pointer
    2. 16. Arrays, Pointers, and References
      1. 16.1 Arrays
      2. 16.2 Pointers and references
      3. 16.3 C-style strings
      4. 16.4 Alternatives to pointer use
      5. 16.5 An example: palindromes
    3. 17. Essential Operations
      1. 17.1 Introduction
      2. 17.2 Access to elements
      3. 17.3 List initialization
      4. 17.4 Copying and moving
      5. 17.5 Essential operations
      6. 17.6 Other useful operations
      7. 17.7 Remaining Vector problems
      8. 17.8 Changing size
      9. 17.9 Our Vector so far
    4. 18. Templates and Exceptions
      1. 18.1 Templates
      2. 18.2 Generalizing Vector
      3. 18.3 Range checking and exceptions
      4. 18.4 Resources and exceptions
      5. 18.5 Resource-management pointers
    5. 19. Containers and Iterators
      1. 19.1 Storing and processing data
      2. 19.2 Sequences and iterators
      3. 19.3 Linked lists
      4. 19.4 Generalizing Vector yet again
      5. 19.5 An example: a simple text editor
      6. 19.6 vector, list, and string
    6. 20. Maps and Sets
      1. 20.1 Associative containers
      2. 20.2 Map
      3. 20.3 unordered_map
      4. 20.4 Timing
      5. 20.5 Set
      6. 20.6 Container overview
      7. 20.7 Ranges and iterators
    7. 21. Algorithms
      1. 21.1 Standard-library algorithms
      2. 21.2 Function objects
      3. 21.3 Numerical algorithms
      4. 21.4 Copying
      5. 21.5 Sorting and searching
  11. Index
  12. Code Snippets

Product information

  • Title: Programming: Principles and Practice Using C++, 3rd Edition
  • Author(s): Bjarne Stroustrup
  • Release date: April 2024
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780138308667