Interactive roadmap

    C++ roadmap

    This roadmap is for complete beginners wanting to build high-performance software. You will learn to write clean, efficient C++ code from scratch.

    Your progress0% · 0 of 22 topics
    Done Learning Skipped OptionalClick any topic to learn more and mark your progress.
    1. 1

      C++ Basics

      0 of 4 done

      Master the core building blocks of every C++ program.

      Take it one small step at a time, and do not worry if compiling feels a bit tricky at first.
    2. 2

      References and Pointers

      0 of 4 done

      Discover how C++ interacts directly with computer memory.

      Visualise memory as a giant row of numbered lockers to keep pointers and references straight in your head.
    3. 3

      Classes and Objects

      0 of 4 done

      Learn object-oriented programming to model real-world concepts.

      Think of a class as a blueprint for a house, and objects as the actual houses built from it.
    4. 4

      RAII and Smart Pointers

      0 of 3 done

      Manage memory safely without leaks using modern C++ techniques.

      Let C++ handle memory cleanup automatically by tying resource ownership to object scopes.
    5. 5

      The Standard Template Library

      0 of 4 done

      Use pre-built containers and algorithms to save time and effort.

      Always check the Standard Template Library before writing your own data structures or sorting functions.
    6. 6

      Modern C++ and Builds

      0 of 3 done

      Write expressive code and learn how to compile larger projects.

      Embrace modern C++ features to write shorter, cleaner, and safer code with less boilerplate.

    Learn it all, with a tutor that never sleeps

    Every topic links to LevelUp lessons, practice exercises and the 24/7 AI Tutor. Your progress updates as you master lessons.

    Every topic explained

    Step 1: C++ Basics

    Learn how to write, compile, and run a simple C++ program to get started.
    Read more

    Writing your first C++ program introduces you to the basic structure of compiled code. You use a text editor to write instructions, a compiler to turn them into machine code, and your terminal to run the result.

    Think of it like writing a recipe that the computer follows step by step. Every C++ program starts running from a special block called the main function.

    Learning this foundation matters because it shows you how your code goes from plain text to a running application on your computer.

    • C++ code must be compiled before it runs
    • Every program needs a main function
    • Text output uses stdcout and the insertion operator
    C++ Reference
    Understand how to store numbers, text, and true-false values in memory.
    Read more

    Variables act as named storage boxes in your computer memory. Different types, such as integers for whole numbers or strings for text, tell the computer how much space to reserve.

    For example, a shopping app needs an integer for item quantities and a floating-point number for prices. Picking the right type keeps your program fast and accurate.

    Understanding types is vital because C++ is strict about what data goes where, helping you catch bugs before your program runs.

    • Variables store different kinds of data
    • Data types include integers, decimals, and text
    • C++ checks types strictly to prevent errors
    Use if statements and loops to make decisions and repeat tasks in your code.
    Read more

    Control flow lets your program make decisions and repeat actions instead of running straight down the page. If statements check conditions, while loops repeat tasks until a goal is met, and for loops count through steps.

    Imagine a smart thermostat that checks if the room is too cold, turning on the heater if needed. This decision-making logic is the heart of problem-solving in software.

    Mastering control flow allows you to build dynamic programs that respond differently to user input.

    • If statements test conditions to make choices
    • Loops repeat blocks of code efficiently
    • Conditions use true or false logic
    Group reusable blocks of code together to keep your programs organised.
    Read more

    Functions are self-contained blocks of code designed to perform a specific task. By breaking a large problem into smaller functions, your code becomes much easier to read and test.

    Think of a calculator app where addition, subtraction, and multiplication each live in their own function. You can call them whenever you need a calculation.

    This organisation is crucial for building larger C++ applications without getting overwhelmed by messy, repetitive code.

    • Functions group reusable code into logical blocks
    • They can accept inputs called parameters
    • Functions can return a calculated result

    Step 2: References and Pointers

    Learn how variables live in your computer memory and how to find their locations.
    Read more

    Every variable you create lives at a specific location in your computer random access memory. A memory address is simply the numerical location of that byte of storage.

    Imagine office building room numbers so post can be delivered to the right desk. Knowing where data lives helps you understand performance.

    This concept forms the bridge between high-level programming and low-level hardware control, which is why C++ is chosen for fast software.

    • Variables occupy physical memory addresses
    • Addresses are usually displayed in hexadecimal format
    • The ampersand operator finds a variable address
    Pointers are variables that store memory addresses, letting you manipulate data efficiently.
    Read more

    A pointer is a special variable that holds the memory address of another variable rather than holding data directly. This lets you pass large data around without copying it.

    Think of a pointer like a signpost pointing towards a house, rather than carrying the house in your pocket. You can follow the signpost to find or change the data.

    Mastering pointers gives you direct control over computer resources, unlocking top-tier performance for demanding applications.

    • Pointers store memory addresses of other variables
    • You dereference pointers to access stored values
    • Pointers require careful handling to avoid bugs
    References act as safe, easy-to-use aliases for existing variables without pointer complexity.
    Read more

    A reference acts as an alternative name, or alias, for an existing variable. Unlike pointers, references cannot be null and do not need awkward dereference syntax.

    Imagine a person who has both a legal name and a friendly nickname; using either name refers to the exact same person.

    References are vital for writing clean C++ because they let functions modify your original variables safely and easily without copying data.

    • References are safer aliases for existing variables
    • They must be initialized when declared
    • They cannot be redirected to another variable later
    (optional)
    Protect your data from accidental changes by marking variables and parameters as constant.
    Read more

    Const correctness means marking data as constant so the compiler prevents accidental changes. It turns programming bugs into compile errors.

    Think of signing a permanent contract in ink rather than pencil; you make it clear that certain details must not be altered.

    Using const makes your code safer for teams and helps the compiler optimise your program for better performance.

    • Const keywords prevent modification of variables
    • They protect function parameters from accidental changes
    • The compiler catches attempts to alter constants

    Step 3: Classes and Objects

    Create custom data types that bundle data and functions together into a single blueprint.
    Read more

    Classes let you create custom data types that combine data variables and functions into a single blueprint. This brings related concepts together in your code.

    For example, a video game character class can store health points and speed, along with functions for walking or jumping.

    Classes are the building blocks of object-oriented programming, helping you model real-world scenarios cleanly and logically.

    • Classes bundle data and functions together
    • Data members represent object properties
    • Member functions define object behaviour
    Control what happens when an object is created and destroyed in your program.
    Read more

    Constructors and destructors manage the lifecycle of an object. A constructor sets up initial values when an object is created, while a destructor cleans up when it is destroyed.

    Think of moving into a rented apartment where the landlord cleans up before you arrive and inspects it when you leave.

    They ensure your objects always start in a valid state and never leak system resources.

    • Constructors run automatically when objects are created
    • Destructors handle cleanup when objects go out of scope
    • They help prevent resource leaks
    Hide internal object details using public and private access modifiers for safer code.
    Read more

    Encapsulation hides the internal workings of a class, exposing only what other parts of the program need to see through public and private keywords.

    Think of an ATM machine where you press buttons to withdraw cash, but the internal mechanical counters remain safely locked away.

    This protection prevents outside code from accidentally breaking your object internal logic, making large programs much easier to maintain.

    • Private data is hidden from outside code
    • Public functions provide controlled access
    • Encapsulation protects object integrity
    (optional)
    Share common features between classes to avoid writing duplicate code.
    Read more

    Inheritance lets you create a new class based on an existing class, inheriting its features while adding new ones or tweaking behaviours.

    For instance, a SavingsAccount class can inherit all features from a general BankAccount class while adding interest calculation.

    This avoids writing duplicate code and establishes a clear hierarchy among your program classes.

    • Derived classes inherit features from base classes
    • Code duplication is reduced
    • Relationships reflect real-world hierarchies

    Step 4: RAII and Smart Pointers

    Bind resource lifespan to object scope so cleanup happens automatically.
    Read more

    Resource Acquisition Is Initialization ties the lifespan of system resources, like files or memory, directly to the lifespan of objects. When an object goes out of scope, its destructor cleans up automatically.

    Think of turning off the lights and locking the front door the exact moment you leave your house.

    This pattern eliminates manual cleanup code and prevents memory leaks, making C++ programs remarkably robust.

    • Resources are acquired when objects are created
    • Cleanup happens automatically in destructors
    • Prevents forgotten resource cleanups
    Use unique pointers to ensure only one part of your code owns a piece of memory.
    Read more

    A unique pointer guarantees that exactly one part of your program owns a specific piece of heap memory at any given time.

    Think of a physical car key; only one person can hold that specific key and drive the car safely.

    This smart pointer prevents memory leaks and double-deletion bugs by enforcing strict, single-owner rules without extra performance overhead.

    • Ensures exclusive ownership of heap memory
    • Cannot be copied, only moved to new owners
    • Deletes memory automatically when it goes out of scope
    Share ownership of data across multiple objects with automatic reference counting.
    Read more

    A shared pointer allows multiple parts of your program to share ownership of the same piece of data safely using reference counting.

    Think of a shared streaming subscription where several family members can watch shows, and the service cancels only when the last person leaves.

    This prevents data from disappearing while someone is still using it, though you must watch out for circular dependencies.

    • Multiple pointers can share data ownership
    • Keeps a count of active references
    • Deletes memory when the last reference vanishes

    Step 5: The Standard Template Library

    Store lists of items in dynamic arrays that automatically resize when needed.
    Read more

    Vectors are dynamic arrays that automatically resize themselves when you add or remove items, unlike fixed-size traditional arrays.

    Think of an expandable shopping basket that grows bigger as you drop more items inside.

    Vectors are the go-to data structure in C++ because they provide fast element access and easy resizing for everyday programming tasks.

    • Vectors resize dynamically as needed
    • Provide fast random access using index numbers
    • Store items in contiguous memory blocks
    Store key-value pairs and unique collections for fast searching and sorting.
    Read more

    Maps store key-value pairs for quick lookups, while sets store collections of unique items with no duplicates allowed.

    Think of a phone book where you look up a name to find a phone number, or a guest list where each person appears only once.

    These collections make searching and organizing complex data fast and straightforward.

    • Maps link unique keys to specific values
    • Sets automatically prevent duplicate entries
    • Built for fast searching and sorting
    Sort, search, and transform your data quickly using ready-made functions.
    Read more

    The Standard Template Library provides ready-made algorithms for common tasks like sorting, searching, reversing, and counting data.

    Think of using a professional kitchen food processor instead of chopping vegetables by hand for every meal.

    These algorithms are heavily optimized, saving you time and reducing bugs in your code.

    • Ready-made functions for sorting and searching
    • Work seamlessly with vectors and other containers
    • Optimised for high performance
    (optional)
    Navigate through different types of containers using a unified pointer-like interface.
    Read more

    Iterators act as a unified bridge, letting you step through the elements of any container without needing to know how it stores data internally.

    Think of a bookmark that helps you move page by page through different types of books.

    They provide a consistent way to traverse vectors, maps, and sets alike.

    • Provide a uniform way to traverse containers
    • Act like lightweight pointers to elements
    • Work with algorithms to process data ranges

    Step 6: Modern C++ and Builds

    Let the compiler figure out variable types automatically to reduce typing.
    Read more

    The auto keyword lets the compiler deduce the data type of a variable automatically based on its initial value.

    Think of a smart label maker that reads what you put inside a box and prints the exact correct label automatically.

    This cuts down on typing out long, complex container types while keeping your code fully type-safe.

    • Compiler figures out variable types automatically
    • Reduces clutter from long type names
    • Does not affect runtime performance
    Write quick, anonymous inline functions for use in sorting or filtering.
    Read more

    Lambda expressions let you write small, anonymous inline functions right where you need them, perfect for short sorting or filtering tasks.

    Think of writing a quick sticky note instruction for a specific task instead of creating a whole formal procedure document.

    Lambdas make your code more compact and keep related logic together.

    • Anonymous inline functions for quick tasks
    • Can capture variables from the surrounding scope
    • Great for passing into algorithms
    Learn how to manage and compile multi-file projects using CMake.
    Read more

    CMake is a tool that manages the build process for multi-file projects, creating instructions for your compiler across different operating systems.

    Think of a construction manager who coordinates builders, plumbers, and electricians so everyone works together smoothly.

    Learning a build system is essential for growing beyond single-file scripts into building real software applications.

    • Automates compilation across multiple files
    • Works across different operating systems
    • Standard tool for modern C++ projects

    Related roadmaps