O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

C++ By Example: UnderC Learning Edition

Book Description

C++ by Example includes 'UnderC,' an open-source language interpreter developed by the author, which shows the result of each new programming technique instantly, allowing novices to experiment in a more dynamic learning environment. The book starts with the fundamentals of the language, including expressions, variables, functions, and definitions and then covers the most common C++ features including

  • Organizing data with Arrays

  • Standard Algorithms and Containers

  • Using Libraries within C++ programs

  • Going beyond Arrays with Structures

  • Using Pointers

  • Manipulating data using Operators

  • The second half of the book covers OOP, including Classes, Inheritance, Encapsulation, and more. The final chapters include useful command and library references and appendices covering the preprocessor and freeware C++ compilers.

    Table of Contents

    1. Copyright
    2. About the Author
    3. Acknowledgments
    4. Tell Us What You Think!
    5. Introduction
    6. C++ Fundamentals
      1. Expressions and Variables
        1. Using C++ as a Calculator
        2. Numerical Types
        3. Variables
        4. Constants: const and enum
        5. Operators and Shortcuts
        6. Strings
        7. Input and Output
        8. What's Next
      2. Functions and Control Statements
        1. Defining Your Own Functions
        2. Control Statements
        3. Scope
        4. Case Study: A Bug and Defect Tracking System
        5. What's Next
      3. Arrays and Algorithms
        1. Arrays
        2. Containers
        3. Iterators
        4. Case Study: Calculating Simple Statistics
        5. Case Study: Histograms
        6. What's Next
      4. Programs and Libraries
        1. Header Files
        2. Programs
        3. Namespaces
        4. Defensive Programming
        5. Case Study: A Reverse-Polish Calculator
        6. What's Next
      5. Structures and Pointers
        1. User-Defined Structures
        2. Passing structs to Functions
        3. Arrays of Structures
        4. Pointers
        5. Case Study: The Bug Tracking Program Revisited
        6. What's Next
      6. Overloading Functions and Operators
        1. Default Values for Parameters
        2. Overloading Functions
        3. Overloading Operators
        4. Recursion
        5. Function Pointers
        6. Case Study: Drawing Shapes with Turtle Graphics
        7. What's Next
    7. Object Oriented C++
      1. Classes
        1. Member Functions
        2. The Idea of Encapsulation
        3. Constructors and Destructors
        4. Operators as Methods
        5. Interfaces and Implementations
        6. Case Study: Wrapping a Class for Downloading Web Pages
        7. What's Next?
      2. Inheritance and Virtual Methods
        1. The Idea of Inheritance
        2. Polymorphism
        3. Code Reuse
        4. Case Study: The Drawing Program Revisited
        5. What's Next?
      3. Copying, Initialization, and Assignment
        1. Copying
        2. The Life of Objects
        3. Case Study: A Resizable Array
        4. Case Study: Writing XML/HTML
        5. What's Next
      4. Templates
        1. Generic Functions
        2. Functions That Operate on Any Sequence
        3. Class Templates
        4. Case Study: Smart Pointers
        5. What's Next
    8. Appendices
      1. UnderC for Windows (UCW) Command Reference
        1. Loading and Running Programs
        2. Setting Breakpoints
        3. Inspecting Values
        4. Using Quincy 2000
      2. A Short Library Reference
        1. The <iostream> Library
        2. The C++ Standard string Class
        3. C++ Standard Containers: list and vector
        4. C++ Standard Algorithms: <algorithm>
        5. Numerical Operations
        6. C Library Functions
        7. Yet Another Windows Library
      3. The C++ Preprocessor
        1. Preprocessing Programs
        2. Macros
        3. Conditional Compilation
      4. Compiling C++ Programs and DLLs with GCC and BCC32
        1. Getting Free Compilers
        2. The Compilation Process: Compile, Link, Go
        3. Building a YAWL Application
        4. Linking a DLL into UCW
        5. Building a DLL with GCC
        6. A Simple Makefile
        7. Using Compiler Extensions