The
C++
Workshop

Built by a team of experts to help you unlock your next promotion, reboot your career, or kick off your latest side project.
Cover for The C++ Workshop

Get Started Today

You'll be up and running with C++ in no time at all.

  • $34.99

    $34.99The C++ Workshop

    Unlock one year of full, unlimited access and get started right away!
    Learn for Free

Engineered for Success

Nobody likes going through hundreds of pages of dry theory, or struggling with uninteresting examples that don’t compile. We've got you covered. Any time, any device.

  • Learn by doing real-world development, supported by detailed step-by-step examples, screencasts and knowledge checks.

  • Become a verified practitioner, building your credentials by completing exercises, activities and assessment checks.

  • Manage your learning based on your personal schedule, with content structured to easily let you pause and progress at will.

Learn By Doing

You already know you want to learn C++, and the best way to learn C++ is to learn by doing.

The C++ Workshop focuses on building up your practical skills so that you can develop high-performance software applications or even your own independent games.

On Your Terms

Build up and reinforce key skills in a way that feels rewarding.

You won't have to sit through any unnecessary theory. If you're short on time you can jump into a single exercise each day or spend an entire weekend learning about advanced object-oriented principles.

An Ideal Start

Fast-paced and direct, The C++ Workshop is the ideal companion for newcomers.

You'll build and iterate on your code like a software developer, learning along the way. This process means that you'll find that your new skills stick, embedded as best practice. A solid foundation for the years ahead.

Begin Your Journey

A simple, straightforward and pain-free way to learn C++.

  • $34.99

    $34.99The C++ Workshop

    Unlock one year of full, unlimited access and get started right away!
    Buy Now

Everything You Need

Every Workshop includes access to dedicated support, course discussions and a wider learning community. Ask questions, share answers and work with the community to expand your learning.

  • Engage and participate in live user discussions, baked right into your course from start to finish. Share, learn and grow together.

  • Get live updates and interact directly with the product development, editorial and authoring teams across the Packt network.

  • Create, showcase and share your own learning outcomes and motivational stories across the entire workshop community.

Get Build-Ready

Every Workshop includes a whole host of features that work together to help you get the job done. You’ll be ready to tackle real-world development in no time.
  • Hack Your Brain

    We've applied the latest pedagogical techniques to deliver a truly multimodal experience. It'll keep you engaged and make the learning stick. It's science!

  • Build Real Things

    Nobody likes wasting their time. We cut right to the action and get you building real skills that real, working developers value. The perfect approach for a career move.

  • Learn From Experts

    We've paired technical experts with top editorial talent. They've worked hard to deliver you the maximum impact for each minute you spend learning. It's our secret sauce.

  • Verify Your Credentials

    You can become a verified practitioner. Complete the course to get a certificate. It's perfect for sharing on social media. Hello LinkedIn!

  • Receive Free Updates

    Technology keeps changing, and so do we. We keep versions updated independently, so you'll always have access. No more worrying about third-party release cycles.

  • Access Anywhere

    All you need is an internet connection. We've built every course so that it works on desktop and mobile, giving you options that fit within your schedule.

What's Inside

From A to Z, we've got you covered!

  • Workshop Onboarding

    • Welcome to The C++ Workshop
    • Installation and Setup
    • Credits
  • 1. Your First C++ Application

    • Overview
    • Advantages of C++
    • Exercise 1: Compiling Our First Application
    • Exercise 1: Compiling Our First Application
    • C++ Build Pipeline
    • C++ Keywords
    • Preprocessor Directives
    • Exercise 2: Defining Values with Preprocessor Directives
    • Exercise 2: Defining Values with Preprocessor Directives
    • Basic I/O Statements
    • Exercise 3: Reading User Details
    • Exercise 3: Reading User Details
    • Functions
    • Exercise 4: Functions
    • Exercise 4: Functions
    • Activity 1: Writing Your Own C++ Application
    • Summary
  • 2. Control Flow

    • Overview
    • if/else
    • Exercise 5: Implementing if/else Statements
    • Exercise 5: Implementing if/else Statements
    • Exercise 6: Creating a Simple Menu Program Using an if/else Statement
    • Exercise 6: Creating a Simple Menu Program Using an if/else Statement
    • switch/case
    • Exercise 7: Refactor an if/else Chain into switch/case
    • Exercise 7: Refactor an if/else Chain into switch/case
    • Loops
    • Exercise 8: Implementing a while Loop
    • Exercise 8: Implementing a while Loop
    • do while
    • Exercise 9: Implementing while and do while Loops with a False Condition
    • Exercise 9: Implementing while and do while Loops with a False Condition
    • for
    • Exercise 10: Implementing a for Loop
    • Exercise 10: Implementing a for Loop
    • Exercise 11: Generating Random Numbers Using Loops
    • Exercise 11: Generating Random Numbers Using Loops
    • break/continue
    • Exercise 12: Making a Loop More Efficient Using break and continue
    • Exercise 12: Making a Loop More Efficient Using break and continue
    • Activity 2: Creating a Number-Guessing Game Using Loops and Conditional Statements
    • Summary
  • 3. Built-In Data Types

    • Overview
    • Data Types
    • Exercise 13: Declaring Data Types
    • Exercise 13: Declaring Data Types
    • Containers
    • Exercise 14: Implementing Containers to Store Usernames
    • Exercise 14: Implementing Containers to Store Usernames
    • Exercise 15: Using Multidimensional Arrays to Store More Data
    • Exercise 15: Using Multidimensional Arrays to Store More Data
    • Vectors
    • Exercise 16: Looping over a Vector
    • Exercise 16: Looping over a Vector
    • Initialization
    • Exercise 17: Modifying a Vector
    • Exercise 17: Modifying a Vector
    • Classes/Structs
    • Exercise 18: Using Accessibility Modifers to Control Access
    • Exercise 18: Using Accessibility Modifers to Control Access
    • Constructors/Destructors
    • Exercise 19: Classes/Struct
    • Exercise 19: Classes/Struct
    • Exercise 20: Storage Lifetime Example
    • Exercise 20: Storage Lifetime Example
    • Static
    • Activity 3: Sign-Up Application
    • Summary
  • 4. Operators

    • Overview
    • Arithmetic Operators
    • Exercise 21: The Prime Number Checker
    • Exercise 21: The Prime Number Checker
    • Relational Operators
    • Exercise 22: The Time-of-Day Calculator
    • Exercise 22: The Time-of-Day Calculator
    • Unary Operators
    • Exercise 23: A Pre-Increment/Post-Increment Example
    • Exercise 23: A Pre-Increment/Post-Increment Example
    • Assignment Operators
    • Exercise 24: Logical Operators Example
    • Exercise 24: Logical Operators Example
    • Operator Overloading
    • Exercise 25: Operator Overloading Example
    • Exercise 25: Operator Overloading Example
    • Bitwise Operators
    • Activity 4: Fizz Buzz
    • Summary
    • Survey I
  • 5. Pointers and References

    • Overview
    • Memory Addresses
    • Exercise 26: Pointers
    • Exercise 26: Pointers
    • Exercise 27: Dereferencing nullptr
    • Exercise 27: Dereferencing nullptr
    • Exercise 28: Pointers to Arrays
    • Exercise 28: Pointers to Arrays
    • Exercise 29: Pointer Arithmetic
    • Exercise 29: Pointer Arithmetic
    • Exercise 30: Incrementing Pointers
    • Exercise 30: Incrementing Pointers
    • Exercise 31: Pointers to Pointers
    • Exercise 31: Pointers to Pointers
    • Exercise 32: References
    • Exercise 32: References
    • Exercise 33: Bad References
    • Exercise 33: Bad References
    • Exercise 34: Pointers as Function Arguments
    • Exercise 34: Pointers as Function Arguments
    • Exercise 35: Pointers to Class Instance
    • Exercise 35: Pointers to Class Instance
    • Exercise 36: References as Function Arguments
    • Exercise 36: References as Function Arguments
    • Activity 5: Using Pointers and References to Manipulate an Array of Strings
    • Summary
  • 6. Dynamic Variables

    • Overview
    • Dynamic Variables
    • Exercise 37: Creating and Deleting Dynamic Variables of Basic Types
    • Exercise 37: Creating and Deleting Dynamic Variables of Basic Types
    • Exercise 38: Creating and Deleting Dynamic Class Instances
    • Exercise 38: Creating and Deleting Dynamic Class Instances
    • Exercise 39: Creating and Deleting Dynamic Arrays of Basic Types
    • Exercise 39: Creating and Deleting Dynamic Arrays of Basic Types
    • Exercise 40: Creating and Deleting Dynamic Arrays of Classes
    • Exercise 40: Creating and Deleting Dynamic Arrays of Classes
    • Exercise 41: Using a Dynamic Variable before Creating It
    • Exercise 41: Using a Dynamic Variable before Creating It
    • Exercise 42: Using a Dynamic Variable after Deleting It
    • Exercise 42: Using a Dynamic Variable after Deleting It
    • Exercise 43: Not Deleting a Dynamic Variable
    • Exercise 43: Not Deleting a Dynamic Variable
    • Exercise 44: Overwriting a Pointer to a Dynamic Variable
    • Exercise 44: Overwriting a Pointer to a Dynamic Variable
    • Exercise 45: Deleting a Dynamic Variable Twice
    • Exercise 45: Deleting a Dynamic Variable Twice
    • Exercise 46: Deleting a Dynamic Array with delete instead of delete[]
    • Exercise 46: Deleting a Dynamic Array with delete instead of delete[]
    • Exercise 47: Deleting a Dynamic Variable with delete[] instead of delete
    • Exercise 47: Deleting a Dynamic Variable with delete[] instead of delete
    • Dynamic Containers
    • Exercise 48: Creating Linked Lists of Class Instances
    • Exercise 48: Creating Linked Lists of Class Instances
    • Activity 6: Creating Binary Search Trees of Class Instances
    • Summary
  • 7. Ownership and Lifetime of Dynamic Variables

    • Overview
    • The Lifetime of Dynamic Variables
    • Exercise 49: Lifetime Demonstration
    • Exercise 49: Lifetime Demonstration
    • Exercise 50: Owned Pointers in Data Structures
    • Exercise 50: Owned Pointers in Data Structures
    • Exercise 51: Transfer of Ownership
    • Exercise 51: Transfer of Ownership
    • Smart Pointers – Automated Ownership of Dynamic Variables
    • Exercise 52: Working with unique_ptr<>
    • Exercise 52: Working with unique_ptr<>
    • Exercise 53: Using make_unique()
    • Exercise 53: Using make_unique()
    • Exercise 54: Using unique_ptr<> as a Class Member Variable
    • Exercise 54: Using unique_ptr<> as a Class Member Variable
    • Exercise 55: Using unique_ptr<> in Function Return Values
    • Exercise 55: Using unique_ptr<> in Function Return Values
    • Exercise 56: Using shared_ptr<>
    • Exercise 56: Using shared_ptr<>
    • Exercise 57: Using make_shared()
    • Exercise 57: Using make_shared()
    • Activity 7: Storing the Words of a Book Using Dynamic Variables
    • Summary
  • 8. Classes and Structs

    • Overview
    • Classes versus Structs
    • Unions
    • Constructors and Destructors
    • Exercise 58: Defining a Default Constructor
    • Exercise 58: Defining a Default Constructor
    • Exercise 59: Defining a Parameterized Constructor
    • Exercise 59: Defining a Parameterized Constructor
    • Copy Constructors
    • Exercise 60: Defining a Copy Constructor
    • Exercise 60: Defining a Copy Constructor
    • Copy Assignment Operator
    • Exercise 61: Overloading the Assignment Operator
    • Exercise 61: Overloading the Assignment Operator
    • Destructors
    • Activity 8: Creating a VideoClip Class
    • Summary
    • Survey II
  • 9. Object-Oriented Principles

    • Overview
    • Classes and OOP
    • Exercise 62: Creating a Class that Prints Values
    • Exercise 62: Creating a Class that Prints Values
    • Encapsulation
    • Exercise 63: Creating a Position Class with Private Member Variables
    • Exercise 63: Creating a Position Class with Private Member Variables
    • Getters and Setters
    • Exercise 64: Getters and Setters in a Position Class
    • Exercise 64: Getters and Setters in a Position Class
    • Return Value or Reference
    • Activity 9: A Basic RPG Combat System
    • Summary
  • 10. Advanced Object Oriented Principles

    • Overview
    • Inheritance
    • Exercise 65: Inheritance
    • Exercise 65: Inheritance
    • Multiple Inheritance
    • Exercise 66: Multiple Inheritance
    • Exercise 66: Multiple Inheritance
    • Exercise 67: Access Modifiers and Inheritance
    • Exercise 67: Access Modifiers and Inheritance
    • Virtual Functions
    • Exercise 68: Virtual Functions
    • Exercise 68: Virtual Functions
    • Exercise 69: Polymorphism
    • Exercise 69: Polymorphism
    • Casting between Types
    • Exercise 70: Casting
    • Exercise 70: Casting
    • Activity 10: An Encyclopedia Application
    • Summary
  • 11. Templates

    • Overview
    • Exercise 71: Creating Different Types for the Position Objects
    • Exercise 71: Creating Different Types for the Position Objects
    • Multiple Template Parameters
    • Exercise 72: Comparing Position Values Using a Template Function
    • Exercise 72: Comparing Position Values Using a Template Function
    • Template Specialization
    • Creating a Generic Queue
    • Activity 11: Creating a Generic Stack
    • Summary
  • 12. Containers and Iterators

    • Overview
    • Containers
    • Exercise 73: Creating Strings
    • Exercise 73: Creating Strings
    • Assigning to Strings
    • Exercise 74: Is it a Palindrome?
    • Exercise 74: Is it a Palindrome?
    • Vectors- Handy, Resizable Arrays
    • Exercise 75: Accessing Elements in a Vector
    • Exercise 75: Accessing Elements in a Vector
    • Operations on Vectors
    • Exercise 76: Sorting Vectors with a Custom Comparison
    • Exercise 76: Sorting Vectors with a Custom Comparison
    • Map/Unordered Map: Our Associative Containers
    • Exercise 77: Map Quiz
    • Exercise 77: Map Quiz
    • Exercise 78: A Custom Comparator for a Set
    • Exercise 78: A Custom Comparator for a Set
    • Exercise 79: Using a Set to Get the Number of Unique Elements in a Multiset
    • Exercise 79: Using a Set to Get the Number of Unique Elements in a Multiset
    • Queues/Stacks
    • Activity 12: Converting RPG Combat to Use Standard Library Containers
    • Summary
    • Survey III
  • 13. Exception Handling in C++

    • Overview
    • Responding to Unexpected Events
    • Exercise 80: Throwing Uncaught Exceptions
    • Exercise 80: Throwing Uncaught Exceptions
    • Catching Exceptions
    • Exercise 81: try/catch Blocks
    • Exercise 81: try/catch Blocks
    • Exercise 82: Exceptions Thrown by C++
    • Exercise 82: Exceptions Thrown by C++
    • Unwinding the Stack
    • Exercise 83: Unwinding the Stack
    • Exercise 83: Unwinding the Stack
    • Activity 13: Handling Exceptions
    • Summary
  • Activity Solutions

    • Activity 1: Write Your Own C++ Application
    • Activity 1: Write Your Own C++ Application
    • Activity 2: Creating a Number-Guessing Game Using Loops and Conditional Statements
    • Activity 2: Creating a Number-Guessing Game Using Loops and Conditional Statements
    • Activity 3: Sign-Up Application
    • Activity 3: Sign-Up Application
    • Activity 4: Fizz Buzz
    • Activity 4: Fizz Buzz
    • Activity 5: Using Pointers and References to Manipulate an Array of Strings
    • Activity 5: Using Pointers and References to Manipulate an Array of Strings
    • Activity 6: Creating Binary Search Trees of Class Instances
    • Activity 6: Creating Binary Search Trees of Class Instances
    • Activity 7: Storing the Words of a Book Using Dynamic Variables
    • Activity 7: Storing the Words of a Book Using Dynamic Variables
    • Activity 8: Creating a Video Clip Class
    • Activity 8: Creating a Video Clip Class
    • Activity 9: A Basic RPG Combat System
    • Activity 9: A Basic RPG Combat System
    • Activity 10: An Encyclopedia Application
    • Activity 10: An Encyclopedia Application
    • Activity 11: Creating a Generic Stack
    • Activity 11: Creating a Generic Stack
    • Activity 12: Converting RPG Combat to Use Standard Library Containers
    • Activity 12: Converting RPG Combat to Use Standard Library Containers
    • Activity 13: Handling Exceptions
    • Activity 13: Handling Exceptions

Get Verified

Complete The C++ Workshop to unlock your certificate.

You can unlock the certificate by completing the course. The credentials are easy to share, and are ideal for displaying on your LinkedIn profile.
A copy of a certificate of The C++ Workshop

Take A Step Forward

There has never been a better time to start learning C++.

  • $34.99

    $34.99The C++ Workshop

    Unlock one year of full, unlimited access and get started right away!
    Learn for Free

Already Know C++?

Don't worry, we've got your back with other languages and frameworks too!

Show me my options!