Programming: Principles and Practice Using C++, 2nd Edition

Book description

An Introduction to Programming by the Inventor of C++

Preparation for Programming in the Real World

The book assumes that you aim eventually to write non-trivial programs, whether for work in software development or in some other technical field.

Focus on Fundamental Concepts and Techniques

The book explains fundamental concepts and techniques in greater depth than traditional introductions. This approach will give you a solid foundation for writing useful, correct, maintainable, and efficient code.

Programming with Todays C++ (C++11 and C++14)

The book is an introduction to programming in general, including object-oriented programming and generic programming. It is also a solid introduction to the C++ programming language, one of the most widely used languages for real-world software. The book presents modern C++ programming techniques from the start, introducing the C++ standard library and C++11 and C++14 features to simplify programming tasks.

For BeginnersAnd Anyone Who Wants to Learn Something New

The book is primarily designed for people who have never programmed before, and it has been tested with many thousands of first-year university students. It has also been extensively used for self-study. Also, practitioners and advanced students have gained new insight and guidance by seeing how a master approaches the elements of his art.

Provides a Broad View

The first half of the book covers a wide range of essential concepts, design and programming techniques, language features, and libraries. Those will enable you to write programs involving input, output, computation, and simple graphics. The second half explores more specialized topics (such as text processing, testing, and the C programming language) and provides abundant reference material. Source code and support supplements are available from the authors website.

Table of contents

  1. Cover Page
  2. About This eBook
  3. Title Page
  4. Copyright Page
  5. Contents
  6. Preface
  7. Chapter 0 Notes to the Reader
    1. 0.1 The structure of this book
      1. 0.1.1 General approach
      2. 0.1.2 Drills, exercises, etc.
      3. 0.1.3 What comes after this book?
    2. 0.2 A philosophy of teaching and learning
      1. 0.2.1 The order of topics
      2. 0.2.2 Programming and programming language
      3. 0.2.3 Portability
    3. 0.3 Programming and computer science
    4. 0.4 Creativity and problem solving
    5. 0.5 Request for feedback
    6. 0.6 References
    7. 0.7 Biographies
      1. Bjarne Stroustrup
      2. Lawrence “Pete” Petersen
  8. Chapter 1 Computers, People, and Programming
    1. 1.1 Introduction
    2. 1.2 Software
    3. 1.3 People
    4. 1.4 Computer science
    5. 1.5 Computers are everywhere
      1. 1.5.1 Screens and no screens
      2. 1.5.2 Shipping
      3. 1.5.3 Telecommunications
      4. 1.5.4 Medicine
      5. 1.5.5 Information
      6. 1.5.6 A vertical view
      7. 1.5.7 So what?
    6. 1.6 Ideals for programmers
  9. Part I The Basics
    1. Chapter 2 Hello, World!
      1. 2.1 Programs
      2. 2.2 The classic first program
      3. 2.3 Compilation
      4. 2.4 Linking
      5. 2.5 Programming environments
    2. Chapter 3 Objects, Types, and Values
      1. 3.1 Input
      2. 3.2 Variables
      3. 3.3 Input and type
      4. 3.4 Operations and operators
      5. 3.5 Assignment and initialization
        1. 3.5.1 An example: detect repeated words
      6. 3.6 Composite assignment operators
        1. 3.6.1 An example: find repeated words
      7. 3.7 Names
      8. 3.8 Types and objects
      9. 3.9 Type safety
        1. 3.9.1 Safe conversions
        2. 3.9.2 Unsafe conversions
    3. Chapter 4 Computation
      1. 4.1 Computation
      2. 4.2 Objectives and tools
      3. 4.3 Expressions
        1. 4.3.1 Constant expressions
        2. 4.3.2 Operators
        3. 4.3.3 Conversions
      4. 4.4 Statements
        1. 4.4.1 Selection
        2. 4.4.2 Iteration
      5. 4.5 Functions
        1. 4.5.1 Why bother with functions?
        2. 4.5.2 Function declarations
      6. 4.6 vector
        1. 4.6.1 Traversing a vector
        2. 4.6.2 Growing a vector
        3. 4.6.3 A numeric example
        4. 4.6.4 A text example
      7. 4.7 Language features
    4. Chapter 5 Errors
      1. 5.1 Introduction
      2. 5.2 Sources of errors
      3. 5.3 Compile-time errors
        1. 5.3.1 Syntax errors
        2. 5.3.2 Type errors
        3. 5.3.3 Non-errors
      4. 5.4 Link-time errors
      5. 5.5 Run-time errors
        1. 5.5.1 The caller deals with errors
        2. 5.5.2 The callee deals with errors
        3. 5.5.3 Error reporting
      6. 5.6 Exceptions
        1. 5.6.1 Bad arguments
        2. 5.6.2 Range errors
        3. 5.6.3 Bad input
        4. 5.6.4 Narrowing errors
      7. 5.7 Logic errors
      8. 5.8 Estimation
      9. 5.9 Debugging
        1. 5.9.1 Practical debug advice
      10. 5.10 Pre- and post-conditions
        1. 5.10.1 Post-conditions
      11. 5.11 Testing
    5. Chapter 6 Writing a Program
      1. 6.1 A problem
      2. 6.2 Thinking about the problem
        1. 6.2.1 Stages of development
        2. 6.2.2 Strategy
      3. 6.3 Back to the calculator!
        1. 6.3.1 First attempt
        2. 6.3.2 Tokens
        3. 6.3.3 Implementing tokens
        4. 6.3.4 Using tokens
        5. 6.3.5 Back to the drawing board
      4. 6.4 Grammars
        1. 6.4.1 A detour: English grammar
        2. 6.4.2 Writing a grammar
      5. 6.5 Turning a grammar into code
        1. 6.5.1 Implementing grammar rules
        2. 6.5.2 Expressions
        3. 6.5.3 Terms
        4. 6.5.4 Primary expressions
      6. 6.6 Trying the first version
      7. 6.7 Trying the second version
      8. 6.8 Token streams
        1. 6.8.1 Implementing Token_stream
        2. 6.8.2 Reading tokens
        3. 6.8.3 Reading numbers
      9. 6.9 Program structure
    6. Chapter 7 Completing a Program
      1. 7.1 Introduction
      2. 7.2 Input and output
      3. 7.3 Error handling
      4. 7.4 Negative numbers
      5. 7.5 Remainder: %
      6. 7.6 Cleaning up the code
        1. 7.6.1 Symbolic constants
        2. 7.6.2 Use of functions
        3. 7.6.3 Code layout
        4. 7.6.4 Commenting
      7. 7.7 Recovering from errors
      8. 7.8 Variables
        1. 7.8.1 Variables and definitions
        2. 7.8.2 Introducing names
        3. 7.8.3 Predefined names
        4. 7.8.4 Are we there yet?
    7. Chapter 8 Technicalities: Functions, etc.
      1. 8.1 Technicalities
      2. 8.2 Declarations and definitions
        1. 8.2.1 Kinds of declarations
        2. 8.2.2 Variable and constant declarations
        3. 8.2.3 Default initialization
      3. 8.3 Header files
      4. 8.4 Scope
      5. 8.5 Function call and return
        1. 8.5.1 Declaring arguments and return type
        2. 8.5.2 Returning a value
        3. 8.5.3 Pass-by-value
        4. 8.5.4 Pass-by-const-reference
        5. 8.5.5 Pass-by-reference
        6. 8.5.6 Pass-by-value vs. pass-by-reference
        7. 8.5.7 Argument checking and conversion
        8. 8.5.8 Function call implementation
        9. 8.5.9 constexpr functions
      6. 8.6 Order of evaluation
        1. 8.6.1 Expression evaluation
        2. 8.6.2 Global initialization
      7. 8.7 Namespaces
        1. 8.7.1 using declarations and using directives
    8. Chapter 9 Technicalities: Classes, etc.
      1. 9.1 User-defined types
      2. 9.2 Classes and members
      3. 9.3 Interface and implementation
      4. 9.4 Evolving a class
        1. 9.4.1 struct and functions
        2. 9.4.2 Member functions and constructors
        3. 9.4.3 Keep details private
        4. 9.4.4 Defining member functions
        5. 9.4.5 Referring to the current object
        6. 9.4.6 Reporting errors
      5. 9.5 Enumerations
        1. 9.5.1 “Plain” enumerations
      6. 9.6 Operator overloading
      7. 9.7 Class interfaces
        1. 9.7.1 Argument types
        2. 9.7.2 Copying
        3. 9.7.3 Default constructors
        4. 9.7.4 const member functions
        5. 9.7.5 Members and “helper functions”
      8. 9.8 The Date class
  10. Part II Input and Output
    1. Chapter 10 Input and Output Streams
      1. 10.1 Input and output
      2. 10.2 The I/O stream model
      3. 10.3 Files
      4. 10.4 Opening a file
      5. 10.5 Reading and writing a file
      6. 10.6 I/O error handling
      7. 10.7 Reading a single value
        1. 10.7.1 Breaking the problem into manageable parts
        2. 10.7.2 Separating dialog from function
      8. 10.8 User-defined output operators
      9. 10.9 User-defined input operators
      10. 10.10 A standard input loop
      11. 10.11 Reading a structured file
        1. 10.11.1 In-memory representation
        2. 10.11.2 Reading structured values
        3. 10.11.3 Changing representations
    2. Chapter 11 Customizing Input and Output
      1. 11.1 Regularity and irregularity
      2. 11.2 Output formatting
        1. 11.2.1 Integer output
        2. 11.2.2 Integer input
        3. 11.2.3 Floating-point output
        4. 11.2.4 Precision
        5. 11.2.5 Fields
      3. 11.3 File opening and positioning
        1. 11.3.1 File open modes
        2. 11.3.2 Binary files
        3. 11.3.3 Positioning in files
      4. 11.4 String streams
      5. 11.5 Line-oriented input
      6. 11.6 Character classification
      7. 11.7 Using nonstandard separators
      8. 11.8 And there is so much more
    3. Chapter 12 A Display Model
      1. 12.1 Why graphics?
      2. 12.2 A display model
      3. 12.3 A first example
      4. 12.4 Using a GUI library
      5. 12.5 Coordinates
      6. 12.6 Shapes
      7. 12.7 Using Shape primitives
        1. 12.7.1 Graphics headers and main
        2. 12.7.2 An almost blank window
        3. 12.7.3 Axis
        4. 12.7.4 Graphing a function
        5. 12.7.5 Polygons
        6. 12.7.6 Rectangles
        7. 12.7.7 Fill
        8. 12.7.8 Text
        9. 12.7.9 Images
        10. 12.7.10 And much more
      8. 12.8 Getting this to run
        1. 12.8.1 Source files
    4. Chapter 13 Graphics Classes
      1. 13.1 Overview of graphics classes
      2. 13.2 Point and Line
      3. 13.3 Lines
      4. 13.4 Color
      5. 13.5 Line_style
      6. 13.6 Open_polyline
      7. 13.7 Closed_polyline
      8. 13.8 Polygon
      9. 13.9 Rectangle
      10. 13.10 Managing unnamed objects
      11. 13.11 Text
      12. 13.12 Circle
      13. 13.13 Ellipse
      14. 13.14 Marked_polyline
      15. 13.15 Marks
      16. 13.16 Mark
      17. 13.17 Images
    5. Chapter 14 Graphics Class Design
      1. 14.1 Design principles
        1. 14.1.1 Types
        2. 14.1.2 Operations
        3. 14.1.3 Naming
        4. 14.1.4 Mutability
      2. 14.2 Shape
        1. 14.2.1 An abstract class
        2. 14.2.2 Access control
        3. 14.2.3 Drawing shapes
        4. 14.2.4 Copying and mutability
      3. 14.3 Base and derived classes
        1. 14.3.1 Object layout
        2. 14.3.2 Deriving classes and defining virtual functions
        3. 14.3.3 Overriding
        4. 14.3.4 Access
        5. 14.3.5 Pure virtual functions
      4. 14.4 Benefits of object-oriented programming
    6. Chapter 15 Graphing Functions and Data
      1. 15.1 Introduction
      2. 15.2 Graphing simple functions
      3. 15.3 Function
        1. 15.3.1 Default Arguments
        2. 15.3.2 More examples
        3. 15.3.3 Lambda expressions
      4. 15.4 Axis
      5. 15.5 Approximation
      6. 15.6 Graphing data
        1. 15.6.1 Reading a file
        2. 15.6.2 General layout
        3. 15.6.3 Scaling data
        4. 15.6.4 Building the graph
    7. Chapter 16 Graphical User Interfaces
      1. 16.1 User interface alternatives
      2. 16.2 The “Next” button
      3. 16.3 A simple window
        1. 16.3.1 A callback function
        2. 16.3.2 A wait loop
        3. 16.3.3 A lambda expression as a callback
      4. 16.4 Button and other Widgets
        1. 16.4.1 Widgets
        2. 16.4.2 Buttons
        3. 16.4.3 In_box and Out_box
        4. 16.4.4 Menus
      5. 16.5 An example
      6. 16.6 Control inversion
      7. 16.7 Adding a menu
      8. 16.8 Debugging GUI code
  11. Part III Data and Algorithms
    1. Chapter 17 Vector and Free Store
      1. 17.1 Introduction
      2. 17.2 vector basics
      3. 17.3 Memory, addresses, and pointers
        1. 17.3.1 The sizeof operator
      4. 17.4 Free store and pointers
        1. 17.4.1 Free-store allocation
        2. 17.4.2 Access through pointers
        3. 17.4.3 Ranges
        4. 17.4.4 Initialization
        5. 17.4.5 The null pointer
        6. 17.4.6 Free-store deallocation
      5. 17.5 Destructors
        1. 17.5.1 Generated destructors
        2. 17.5.2 Destructors and free store
      6. 17.6 Access to elements
      7. 17.7 Pointers to class objects
      8. 17.8 Messing with types: void* and casts
      9. 17.9 Pointers and references
        1. 17.9.1 Pointer and reference parameters
        2. 17.9.2 Pointers, references, and inheritance
        3. 17.9.3 An example: lists
        4. 17.9.4 List operations
        5. 17.9.5 List use
      10. 17.10 The this pointer
        1. 17.10.1 More link use
    2. Chapter 18 Vectors and Arrays
      1. 18.1 Introduction
      2. 18.2 Initialization
      3. 18.3 Copying
        1. 18.3.1 Copy constructors
        2. 18.3.2 Copy assignments
        3. 18.3.3 Copy terminology
        4. 18.3.4 Moving
      4. 18.4 Essential operations
        1. 18.4.1 Explicit constructors
        2. 18.4.2 Debugging constructors and destructors
      5. 18.5 Access to vector elements
        1. 18.5.1 Overloading on const
      6. 18.6 Arrays
        1. 18.6.1 Pointers to array elements
        2. 18.6.2 Pointers and arrays
        3. 18.6.3 Array initialization
        4. 18.6.4 Pointer problems
      7. 18.7 Examples: palindrome
        1. 18.7.1 Palindromes using string
        2. 18.7.2 Palindromes using arrays
        3. 18.7.3 Palindromes using pointers
    3. Chapter 19 Vector, Templates, and Exceptions
      1. 19.1 The problems
      2. 19.2 Changing size
        1. 19.2.1 Representation
        2. 19.2.2 reserve and capacity
        3. 19.2.3 resize
        4. 19.2.4 push_back
        5. 19.2.5 Assignment
        6. 19.2.6 Our vector so far
      3. 19.3 Templates
        1. 19.3.1 Types as template parameters
        2. 19.3.2 Generic programming
        3. 19.3.3 Concepts
        4. 19.3.4 Containers and inheritance
        5. 19.3.5 Integers as template parameters
        6. 19.3.6 Template argument deduction
        7. 19.3.7 Generalizing vector
      4. 19.4 Range checking and exceptions
        1. 19.4.1 An aside: design considerations
        2. 19.4.2 A confession: macros
      5. 19.5 Resources and exceptions
        1. 19.5.1 Potential resource management problems
        2. 19.5.2 Resource acquisition is initialization
        3. 19.5.3 Guarantees
        4. 19.5.4 unique_ptr
        5. 19.5.5 Return by moving
        6. 19.5.6 RAII for vector
    4. Chapter 20 Containers and Iterators
      1. 20.1 Storing and processing data
        1. 20.1.1 Working with data
        2. 20.1.2 Generalizing code
      2. 20.2 STL ideals
      3. 20.3 Sequences and iterators
        1. 20.3.1 Back to the example
      4. 20.4 Linked lists
        1. 20.4.1 List operations
        2. 20.4.2 Iteration
      5. 20.5 Generalizing vector yet again
        1. 20.5.1 Container traversal
        2. 20.5.2 auto
      6. 20.6 An example: a simple text editor
        1. 20.6.1 Lines
        2. 20.6.2 Iteration
      7. 20.7 vector, list, and string
        1. 20.7.1 insert and erase
      8. 20.8 Adapting our vector to the STL
      9. 20.9 Adapting built-in arrays to the STL
      10. 20.10 Container overview
        1. 20.10.1 Iterator categories
    5. Chapter 21 Algorithms and Maps
      1. 21.1 Standard library algorithms
      2. 21.2 The simplest algorithm: find()
        1. 21.2.1 Some generic uses
      3. 21.3 The general search: find_if()
      4. 21.4 Function objects
        1. 21.4.1 An abstract view of function objects
        2. 21.4.2 Predicates on class members
        3. 21.4.3 Lambda expressions
      5. 21.5 Numerical algorithms
        1. 21.5.1 Accumulate
        2. 21.5.2 Generalizing accumulate()
        3. 21.5.3 Inner product
        4. 21.5.4 Generalizing inner_product()
      6. 21.6 Associative containers
        1. 21.6.1 map
        2. 21.6.2 map overview
        3. 21.6.3 Another map example
        4. 21.6.4 unordered_map
        5. 21.6.5 set
      7. 21.7 Copying
        1. 21.7.1 Copy
        2. 21.7.2 Stream iterators
        3. 21.7.3 Using a set to keep order
        4. 21.7.4 copy_if
      8. 21.8 Sorting and searching
      9. 21.9 Container algorithms
  12. Part IV Broadening the View
    1. Chapter 22 Ideals and History
      1. 22.1 History, ideals, and professionalism
        1. 22.1.1 Programming language aims and philosophies
        2. 22.1.2 Programming ideals
        3. 22.1.3 Styles/paradigms
      2. 22.2 Programming language history overview
        1. 22.2.1 The earliest languages
        2. 22.2.2 The roots of modern languages
        3. 22.2.3 The Algol family
        4. 22.2.4 Simula
        5. 22.2.5 C
        6. 22.2.6 C++
        7. 22.2.7 Today
        8. 22.2.8 Information sources
    2. Chapter 23 Text Manipulation
      1. 23.1 Text
      2. 23.2 Strings
      3. 23.3 I/O streams
      4. 23.4 Maps
        1. 23.4.1 Implementation details
      5. 23.5 A problem
      6. 23.6 The idea of regular expressions
        1. 23.6.1 Raw string literals
      7. 23.7 Searching with regular expressions
      8. 23.8 Regular expression syntax
        1. 23.8.1 Characters and special characters
        2. 23.8.2 Character classes
        3. 23.8.3 Repeats
        4. 23.8.4 Grouping
        5. 23.8.5 Alternation
        6. 23.8.6 Character sets and ranges
        7. 23.8.7 Regular expression errors
      9. 23.9 Matching with regular expressions
      10. 23.10 References
    3. Chapter 24 Numerics
      1. 24.1 Introduction
      2. 24.2 Size, precision, and overflow
        1. 24.2.1 Numeric limits
      3. 24.3 Arrays
      4. 24.4 C-style multidimensional arrays
      5. 24.5 The Matrix library
        1. 24.5.1 Dimensions and access
        2. 24.5.2 1D Matrix
        3. 24.5.3 2D Matrix
        4. 24.5.4 Matrix I/O
        5. 24.5.5 3D Matrix
      6. 24.6 An example: solving linear equations
        1. 24.6.1 Classical Gaussian elimination
        2. 24.6.2 Pivoting
        3. 24.6.3 Testing
      7. 24.7 Random numbers
      8. 24.8 The standard mathematical functions
      9. 24.9 Complex numbers
      10. 24.10 References
    4. Chapter 25 Embedded Systems Programming
      1. 25.1 Embedded systems
      2. 25.2 Basic concepts
        1. 25.2.1 Predictability
        2. 25.2.2 Ideals
        3. 25.2.3 Living with failure
      3. 25.3 Memory management
        1. 25.3.1 Free-store problems
        2. 25.3.2 Alternatives to the general free store
        3. 25.3.3 Pool example
        4. 25.3.4 Stack example
      4. 25.4 Addresses, pointers, and arrays
        1. 25.4.1 Unchecked conversions
        2. 25.4.2 A problem: dysfunctional interfaces
        3. 25.4.3 A solution: an interface class
        4. 25.4.4 Inheritance and containers
      5. 25.5 Bits, bytes, and words
        1. 25.5.1 Bits and bit operations
        2. 25.5.2 bitset
        3. 25.5.3 Signed and unsigned
        4. 25.5.4 Bit manipulation
        5. 25.5.5 Bitfields
        6. 25.5.6 An example: simple encryption
      6. 25.6 Coding standards
        1. 25.6.1 What should a coding standard be?
        2. 25.6.2 Sample rules
        3. 25.6.3 Real coding standards
    5. Chapter 26 Testing
      1. 26.1 What we want
        1. 26.1.1 Caveat
      2. 26.2 Proofs
      3. 26.3 Testing
        1. 26.3.1 Regression tests
        2. 26.3.2 Unit tests
        3. 26.3.3 Algorithms and non-algorithms
        4. 26.3.4 System tests
        5. 26.3.5 Finding assumptions that do not hold
      4. 26.4 Design for testing
      5. 26.5 Debugging
      6. 26.6 Performance
        1. 26.6.1 Timing
      7. 26.7 References
    6. Chapter 27 The C Programming Language
      1. 27.1 C and C++: siblings
        1. 27.1.1 C/C++ compatibility
        2. 27.1.2 C++ features missing from C
        3. 27.1.3 The C standard library
      2. 27.2 Functions
        1. 27.2.1 No function name overloading
        2. 27.2.2 Function argument type checking
        3. 27.2.3 Function definitions
        4. 27.2.4 Calling C from C++ and C++ from C
        5. 27.2.5 Pointers to functions
      3. 27.3 Minor language differences
        1. 27.3.1 struct tag namespace
        2. 27.3.2 Keywords
        3. 27.3.3 Definitions
        4. 27.3.4 C-style casts
        5. 27.3.5 Conversion of void*
        6. 27.3.6 enum
        7. 27.3.7 Namespaces
      4. 27.4 Free store
      5. 27.5 C-style strings
        1. 27.5.1 C-style strings and const
        2. 27.5.2 Byte operations
        3. 27.5.3 An example: strcpy()
        4. 27.5.4 A style issue
      6. 27.6 Input/output: stdio
        1. 27.6.1 Output
        2. 27.6.2 Input
        3. 27.6.3 Files
      7. 27.7 Constants and macros
      8. 27.8 Macros
        1. 27.8.1 Function-like macros
        2. 27.8.2 Syntax macros
        3. 27.8.3 Conditional compilation
      9. 27.9 An example: intrusive containers
  13. Part V Appendices
    1. Appendix A Language Summary
      1. A.1 General
        1. A.1.1 Terminology
        2. A.1.2 Program start and termination
        3. A.1.3 Comments
      2. A.2 Literals
        1. A.2.1 Integer literals
        2. A.2.2 Floating-point-literals
        3. A.2.3 Boolean literals
        4. A.2.4 Character literals
        5. A.2.5 String literals
        6. A.2.6 The pointer literal
      3. A.3 Identifiers
        1. A.3.1 Keywords
      4. A.4 Scope, storage class, and lifetime
        1. A.4.1 Scope
        2. A.4.2 Storage class
        3. A.4.3 Lifetime
      5. A.5 Expressions
        1. A.5.1 User-defined operators
        2. A.5.2 Implicit type conversion
        3. A.5.3 Constant expressions
        4. A.5.4 sizeof
        5. A.5.5 Logical expressions
        6. A.5.6 new and delete
        7. A.5.7 Casts
      6. A.6 Statements
      7. A.7 Declarations
        1. A.7.1 Definitions
      8. A.8 Built-in types
        1. A.8.1 Pointers
        2. A.8.2 Arrays
        3. A.8.3 References
      9. A.9 Functions
        1. A.9.1 Overload resolution
        2. A.9.2 Default arguments
        3. A.9.3 Unspecified arguments
        4. A.9.4 Linkage specifications
      10. A.10 User-defined types
        1. A.10.1 Operator overloading
      11. A.11 Enumerations
      12. A.12 Classes
        1. A.12.1 Member access
        2. A.12.2 Class member definitions
        3. A.12.3 Construction, destruction, and copy
        4. A.12.4 Derived classes
        5. A.12.5 Bitfields
        6. A.12.6 Unions
      13. A.13 Templates
        1. A.13.1 Template arguments
        2. A.13.2 Template instantiation
        3. A.13.3 Template member types
      14. A.14 Exceptions
      15. A.15 Namespaces
      16. A.16 Aliases
      17. A.17 Preprocessor directives
        1. A.17.1 #include
        2. A.17.2 #define
  14. Appendix B Standard Library Summary
    1. B.1 Overview
      1. B.1.1 Header files
      2. B.1.2 Namespace std
      3. B.1.3 Description style
    2. B.2 Error handling
      1. B.2.1 Exceptions
    3. B.3 Iterators
      1. B.3.1 Iterator model
      2. B.3.2 Iterator categories
    4. B.4 Containers
      1. B.4.1 Overview
      2. B.4.2 Member types
      3. B.4.3 Constructors, destructors, and assignments
      4. B.4.4 Iterators
      5. B.4.5 Element access
      6. B.4.6 Stack and queue operations
      7. B.4.7 List operations
      8. B.4.8 Size and capacity
      9. B.4.9 Other operations
      10. B.4.10 Associative container operations
    5. B.5 Algorithms
      1. B.5.1 Nonmodifying sequence algorithms
      2. B.5.2 Modifying sequence algorithms
      3. B.5.3 Utility algorithms
      4. B.5.4 Sorting and searching
      5. B.5.5 Set algorithms
      6. B.5.6 Heaps
      7. B.5.7 Permutations
      8. B.5.8 min and max
    6. B.6 STL utilities
      1. B.6.1 Inserters
      2. B.6.2 Function objects
      3. B.6.3 pair and tuple
      4. B.6.4 initializer_list
      5. B.6.5 Resource management pointers
    7. B.7 I/O streams
      1. B.7.1 I/O streams hierarchy
      2. B.7.2 Error handling
      3. B.7.3 Input operations
      4. B.7.4 Output operations
      5. B.7.5 Formatting
      6. B.7.6 Standard manipulators
    8. B.8 String manipulation
      1. B.8.1 Character classification
      2. B.8.2 String
      3. B.8.3 Regular expression matching
    9. B.9 Numerics
      1. B.9.1 Numerical limits
      2. B.9.2 Standard mathematical functions
      3. B.9.3 Complex
      4. B.9.4 valarray
      5. B.9.5 Generalized numerical algorithms
      6. B.9.6 Random numbers
    10. B.10 Time
    11. B.11 C standard library functions
      1. B.11.1 Files
      2. B.11.2 The printf() family
      3. B.11.3 C-style strings
      4. B.11.4 Memory
      5. B.11.5 Date and time
      6. B.11.6 Etc.
    12. B.12 Other libraries
  15. Appendix C Getting Started with Visual Studio
    1. C.1 Getting a program to run
    2. C.2 Installing Visual Studio
    3. C.3 Creating and running a program
      1. C.3.1 Create a new project
      2. C.3.2 Use the std_lib_facilities.h header file
      3. C.3.3 Add a C++ source file to the project
      4. C.3.4 Enter your source code
      5. C.3.5 Build an executable program
      6. C.3.6 Execute the program
      7. C.3.7 Save the program
    4. C.4 Later
  16. Appendix D Installing FLTK
    1. D.1 Introduction
    2. D.2 Downloading FLTK
    3. D.3 Installing FLTK
    4. D.4 Using FLTK in Visual Studio
    5. D.5 Testing if it all worked
  17. Appendix E GUI Implementation
    1. E.1 Callback implementation
    2. E.2 Widget implementation
    3. E.3 Window implementation
    4. E.4 Vector_ref
    5. E.5 An example: manipulating Widgets
  18. Glossary
  19. Bibliography
  20. Index

Product information

  • Title: Programming: Principles and Practice Using C++, 2nd Edition
  • Author(s): Bjarne Stroustrup
  • Release date: May 2014
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780133796759