Introduction to C++ Programming Training Course

Summary

C++

The C++ language provides a powerful means to write object-oriented applications that scale well over time, have a shorter development cycle, and have improved maintainability. C++ comes with a rich library called STL which helps speed development.

This C++ programming hands-on course provides a solid introduction to object-oriented programming (OOP) concepts, the C++ language, the C++ run-time and development environments and the Standard Template Library (STL). You will learn basic and advanced C++ syntax, constructs, and conventions, become familiar with the API documentation, understand C++’s implementation of the OO paradigm, and apply your newly acquired knowledge by writing a number of programs. After completing this course, you should have the ability to read, understand, and analyze most C++ code, and you should have the skills necessary to begin developing C++ programs.

Duration

5 days

Course Objectives

Upon completion of this Introduction to C++ Programming course you should:

  • Understand the fundamental concepts of the Object-Oriented paradigm and their implementation in the C++ Programming language
  • Understand the procedural programming support provided by C++
  • Be familiar with the C++ language and its run-time and development environments
  • Know how to use STL (the Standard Template Library)
  • Write and maintain C++ applications
  • Create, run, and debug C++ programs
  • Control program flow with conditions and loops
  • Effectively use declarations, assignments, operators, control structures, and program scope
  • Organize C++ code into classes, header and implementation files
  • Understand C++ error handling using try/catch blocks and exceptions
  • Process both text and binary files
  • Utilize best practices developing C++ applications

Audience

This course is ideal for Programmers/Engineers, Support Engineers, and Web Application Developers.

Pre-requisites

  • Some experience programming in at least one other language such as COBOL, C, Java, or in a scripting languages such as UNIX shell, Perl, PHP, or VBScript
  • A solid understanding of the basic programming concepts and constructs (variables, data types, loops and branching, and procedures/subroutines)

Outline

INTRODUCTION TO C++

  • Origins of the C++ Language
  • C++ and Object-Oriented Programming
  • The Character of C++
  • C++ Terminology
  • A Sample C++ Program
  • Fundamental Data Types

PROGRAMMING WITH VISUAL STUDIO AND VISUAL C++

  • Writing C++ Applications
  • Console Applications
  • Components of the Integrated Development Environment
  • Using the IDE
  • Toolbar Options
  • Dockable Toolbars
  • Documentation
  • Projects and Solutions
  • Defining a Project
  • Debug and Release Versions of Your Program
  • Executing the Program
  • Dealing with Errors
  • Setting Options in Visual C++

VARIABLES, EXPRESSIONS, AND ASSIGNMENT STATEMENTS

  • Identifiers
  • Variables
  • Assignment Statements
  • Introduction to the string class
  • More Assignment Statements
  • Assignment Compatibility
  • Literals
  • Escape Sequences
  • Naming Constants
  • Arithmetic Operators and Expressions
  • Relational and Logical Operators and Expressions
  • Integer and Floating-Point Division
  • Type Casting
  • Increment and Decrement Operators

CONSOLE INPUT/OUTPUT

  • Output Using cout
  • New Lines in Output
  • Formatting for Numbers with a Decimal Point
  • Output with cerr
  • Input Using cin

PROGRAM STYLE

  • Comments
  • Whitespace
  • Indentation and Layout
  • Braces

LIBRARIES AND NAMESPACES

  • Libraries and include Directives
  • Namespaces

BOOLEAN EXPRESSIONS

  • Building Boolean Expressions
  • Evaluating Boolean Expressions
  • Precedence Rules

BRANCHING MECHANISMS

  • if-else Statements
  • Compound Statements
  • Omitting the else
  • Nested Statements
  • Chained if-else Statement
  • The switch Statement
  • Enumeration Types
  • The Conditional Operator

LOOPS

  • The while and do-while Statements
  • Increment and Decrement Operators Revisited
  • The Comma Operator
  • The for Statement
  • The break and continue Statements
  • Nested Loops

INTRODUCTION TO FILE INPUT

  • Reading From a Text File Using ifstream

PREDEFINED FUNCTIONS

  • Predefined Functions That Return a Value
  • Predefined void Functions
  • A Random Number Generator

PROGRAMMER-DEFINED FUNCTIONS

  • Function Prototypes
  • Defining Functions That Return a Value
  • Alternate Form for Function Declarations
  • Functions Calling Functions
  • EXAMPLE: A Rounding Function
  • Functions That Return a Boolean Value
  • Defining void Functions
  • return Statements in void Functions
  • Preconditions and Postconditions
  • main Is a Function
  • Recursive Functions

SCOPE RULES

  • Local Variables
  • Procedural Abstraction
  • Global Constants and Global Variables
  • Blocks
  • Nested Scopes
  • Variables Declared in a for Loop

PARAMETERS

  • Call-by-Value Parameters
  • A First Look at Call-by-Reference Parameters
  • Call-by-Reference Mechanism in Detail
  • Constant Reference Parameters
  • Mixed Parameter Lists

OVERLOADING AND DEFAULT ARGUMENTS

  • Introduction to Overloading
  • Rules for Resolving Overloading
  • Default Arguments

TESTING AND DEBUGGING FUNCTIONS

  • The assert Macro
  • Stubs and Drivers

INTRODUCTION TO ARRAYS

  • Declaring and Referencing Arrays
  • Arrays in Memory
  • Initializing Arrays

ARRAYS IN FUNCTIONS

  • Indexed Variables as Function Arguments
  • Entire Arrays as Function Arguments
  • The const Parameter Modifier
  • Functions That Return an Array

PROGRAMMING WITH ARRAYS

  • Partially Filled Arrays
  • EXAMPLE: Searching an Array
  • EXAMPLE: Sorting an Array

MULTIDIMENSIONAL ARRAYS

  • Multidimensional Array Basics
  • Multidimensional Array Parameters

STRUCTURES

  • Structure Types
  • Structures as Function Arguments
  • Initializing Structures

CLASSES

  • Defining Classes and Member Functions
  • Encapsulation
  • Public and Private Members
  • Accessor and Mutator Functions
  • Structures versus Classes

CONSTRUCTORS

  • Constructor Definitions
  • Initializers
  • Explicit Constructor Calls
  • Class Type Member Variables – “Instance” Variables

MORE TOOLS

  • The const Parameter Modifier
  • Inline Functions
  • Static Members
  • Nested and Local Class Definitions

VECTORS – A PREVIEW OF STL, THE STANDARD TEMPLATE LIBRARY

  • Vector Basics
  • Efficiency Issues
  • Passing Vectors to Functions

BASIC OPERATOR OVERLOADING

  • Overloading Basics
  • Returning by const Value
  • Overloading Unary Operators
  • Overloading as Member Functions
  • Overloading Function Application ( )

FRIEND FUNCTIONS AND AUTOMATIC TYPE CONVERSION

  • Constructors for Automatic Type Conversion
  • Friend Functions
  • Friend Classes

REFERENCES AND MORE OVERLOADED OPERATORS

  • References
  • Overloading >> and <<
  • The Assignment Operator
  • Overloading the Increment and Decrement Operators
  • Overloading the Array Operator [ ]
  • Overloading Based on L-Value versus R-Value

AN ARRAY TYPE FOR STRINGS

  • C-String Values and C-String Variables
  • Other Functions in <cstring>
  • EXAMPLE: Command-Line Arguments
  • C-String Input and Output

CHARACTER MANIPULATION TOOLS

  • Character I/O
  • The Member Functions get and put
  • The putback, peek, and ignore Member Functions
  • Character-Manipulating Functions

THE STANDARD CLASS string

  • Introduction to the Standard Class string
  • I/O with the Class string
  • String Processing with the Class string
  • EXAMPLE: Palindrome Testing
  • Converting between string Objects and C-Strings

POINTERS

  • Pointer Variables
  • Address-Of and Dereference Operators
  • Pointer Arithmetic
  • Basic Memory Management
  • Dynamic Variables and Automatic Variables
  • Uses for Pointers

DYNAMIC ARRAYS

  • Array Variables and Pointer Variables
  • Creating and Using Dynamic Arrays
  • EXAMPLE: A Function That Returns an Array
  • Pointer Arithmetic
  • Multidimensional Dynamic Arrays

CLASSES, POINTERS, AND DYNAMIC ARRAYS

  • The -> Operator
  • The this Pointer
  • Overloading the Assignment Operator
  • EXAMPLE: A Class for Partially Filled Arrays
  • Destructors
  • Copy Constructors

SEPARATE COMPILATION

  • Encapsulation Reviewed
  • Header Files and Implementation Files
  • Using #ifndef and #pragma once

NAMESPACES

  • Namespaces and using Directives
  • Creating a Namespace
  • Using Declarations
  • Qualifying Names
  • EXAMPLE: A Class Definition in a Namespace
  • Unnamed Namespaces
  • Nested Namespaces

I/O STREAMS

  • File I/O
  • Appending to a File
  • Character I/O
  • Checking for the End of a File

TOOLS FOR STREAM I/O

  • File Names as Input
  • Formatting Output with Stream Functions
  • Manipulators
  • Saving Flag Settings
  • More Output Stream Member Functions

STREAM HIERARCHIES: A PREVIEW OF INHERITANCE

  • Inheritance among Stream Classes
  • EXAMPLE: Another newLine Function
  • Parsing Strings with the stringstream Class

RECURSIVE void FUNCTIONS

  • Tracing a Recursive Call
  • A Closer Look at Recursion
  • Stacks for Recursion
  • Recursion versus Iteration

RECURSIVE FUNCTIONS THAT RETURN A VALUE

  • General Form for a Recursive Function That Returns a Value
  • EXAMPLE: Another Powers Function
  • Mutual Recursion

THINKING RECURSIVELY

  • Recursive Design Techniques
  • Binary Search
  • Coding
  • Checking the Recursion
  • Efficiency

INHERITANCE BASICS

  • Derived Classes
  • Constructors in Derived Classes
  • The protected Qualifier
  • Redefinition Member Functions
  • Redefining versus Overloading
  • Access to a Redefined Base Function
  • Functions That Are Not Inherited

PROGRAMMING WITH INHERITANCE

  • Assignment Operators and Copy Constructors in Derived Classes
  • Destructors in Derived Classes
  • EXAMPLE: Partially Filled Array with Backup
  • Protected and Private Inheritance
  • Multiple Inheritance

VIRTUAL FUNCTION BASICS

  • Late Binding
  • Virtual Function in C++
  • Abstract Classes and Pure Virtual Functions

POINTERS AND VIRTUAL FUNCTIONS

  • Virtual Functions and Extended Type Compatibility
  • Downcasting and Upcasting
  • How C++ Implements Virtual Functions

FUNCTION TEMPLATES

  • Syntax for Function Templates
  • EXAMPLE: A Generic Sorting Function

CLASS TEMPLATES

  • Syntax for Class Templates
  • EXAMPLE: An Array Template Class
  • The vector and basic_string Templates

TEMPLATES AND INHERITANCE

  • EXAMPLE: Template Class For a Partially Filled Array with Backup

NODES AND LINKED LISTS

  • Nodes
  • Linked Lists
  • Inserting a Node at the Head of a List
  • Inserting and Removing Nodes Inside a List
  • Searching a Linked List
  • Doubly Linked Lists
  • Adding a Node to a Doubly Linked List
  • Deleting a Node from a Doubly Linked List

LINKED LIST APPLICATIONS

  • EXAMPLE: A Stack Template Class
  • EXAMPLE: A Queue Template Class
  • Friend Classes and Similar Alternatives
  • EXAMPLE: Hash Tables With Chaining
  • Efficiency of Hash Tables
  • EXAMPLE: A Set Template Class
  • Efficiency of Sets Using Linked Lists

ITERATORS

  • Pointers as Iterators
  • Iterator Classes
  • EXAMPLE: An Iterator Class

TREES

  • Tree Properties
  • EXAMPLE: A Tree Template Class

EXCEPTION HANDLING BASICS

  • A Toy Example of Exception Handling
  • Defining Your Own Exception Classes
  • Multiple Throws and Catches
  • Throwing an Exception in a Function
  • Exception Specification

PROGRAMMING TECHNIQUES FOR EXCEPTION HANDLING

  • When to Throw an Exception
  • Exception Class Hierarchies
  • Testing for Available Memory
  • Rethrowing an Exception

ITERATORS

  • Iterator Basics
  • Kinds of Iterators
  • Constant and Mutable Iterators
  • Reverse Iterators
  • Other Kinds of Iterators

STL CONTAINERS

  • Sequential Containers – Stack, List, Queue, Deque
  • The Container Adapters stack and queue
  • The Associative Containers set and map
  • Efficiency

STL GENERIC ALGORITHMS

  • Running Times and Big-O Notation
  • Container Access Running Times
  • Nonmodifying Sequence Algorithms
  • Modifying Sequence Algorithms
  • Set Algorithms
  • Sorting Algorithms