Skip to content

The C++ Course

A complete, self-paced modern C++ curriculum in Markdown. Work through it top to bottom, or jump to the level that matches your experience.

How this course is organized

Folder For you if... Outcome
Beginner You have never written C++ (or never finished a course) Write and compile real programs, understand the core language, build a CLI app
Intermediate You know the syntax but pointers, classes and memory still feel shaky Pointers, RAII, smart pointers, classes, templates, the STL, CMake, testing, a real project
Advanced You ship C++ and want depth Move semantics, concepts, constexpr, concurrency, coroutines, performance, UB, ABI

Each lesson is one file and follows the same shape:

  1. What & why – the idea in plain language
  2. Examples – compilable code you should type out yourself
  3. Common mistakes – the traps everyone hits
  4. Exercises – do these; reading is not learning
  5. Recap

Setup (do this first)

You need a compiler that supports C++20: GCC 13+, Clang 17+, or MSVC 2022 (17.8+).

g++ --version       # or: clang++ --version
  • macOS: xcode-select --install gives you Apple Clang; brew install gcc llvm cmake for newer versions
  • Windows: install Visual Studio 2022 Community with the "Desktop development with C++" workload, or use MSYS2 for GCC
  • Linux: sudo apt install build-essential cmake gdb (or your distro's equivalent)

A good editor helps a lot: VS Code with the C/C++ or clangd extension, CLion, or Visual Studio.

Compile every example in this course with warnings turned on:

g++ -std=c++20 -Wall -Wextra -Wpedantic -g main.cpp -o main
./main

How to study

  • Type every example. Copy-paste teaches you nothing.
  • Read the compiler errors. Start at the first error; the rest are often fallout.
  • Break things on purpose. Change a line, predict the result, compile, run.
  • Do the exercises before looking anything up.
  • One lesson per sitting is plenty. Consistency beats marathons.

Curriculum at a glance

Beginner

  1. Setup & your first program
  2. Variables & data types
  3. Numbers & math
  4. Strings
  5. Booleans & conditionals
  6. Loops
  7. Arrays & vectors
  8. Maps & sets
  9. Functions
  10. Headers, namespaces & multi-file programs
  11. Files & error handling
  12. Capstone: command-line task tracker

Intermediate

  1. Pointers & references
  2. Memory: the stack, the heap & RAII
  3. Smart pointers
  4. Classes: fundamentals
  5. Copy, move & the rule of five
  6. Operator overloading
  7. Inheritance & polymorphism
  8. Templates
  9. STL algorithms & lambdas
  10. Build systems: CMake
  11. Testing with Catch2
  12. Capstone: Markdown link checker

Advanced

  1. Move semantics & perfect forwarding
  2. Variadic & advanced templates
  3. Concepts
  4. constexpr & compile-time programming
  5. Concurrency: threads, mutexes & atomics
  6. Async, futures & coroutines
  7. Performance & profiling
  8. Undefined behavior & sanitizers
  9. Design patterns, the C++ way
  10. Ranges & views
  11. Libraries, ABI & packaging
  12. Capstone: parallel file indexer

License

Use freely for learning and teaching.