Course

C++ from the ground up

The language behind fast software, one file at a time

  • Beginner
  • 12 chapters
  • 202 min read

A hands-on introduction to modern C++: the shape of a program, types and const, decisions and loops, functions with defaults and overloading, text and lists, references, maps and sets, structs and classes, lambdas with the algorithm library, templates, and a capstone that sorts records into a report. Every idea runs on a real compiler.

What You'll Learn

  • Write, compile and run a C++ program, and read the compiler when it refuses
  • Name values with the everyday types, and use const where a value should not change
  • Branch and repeat with if, else, for and while
  • Write functions with default arguments, overloads and a void return
  • Measure, search and change text with std::string
  • Keep growing lists in std::vector and walk them with a range-based for
  • Choose between a copy, a reference and a const reference in a function signature
  • Look values up by key with std::map, and refuse repeats with std::set
  • Define your own types with a struct or a class, a constructor and const methods
  • Sort, search and rewrite a range with lambdas and the algorithm library
  • Write a function template once and let the compiler instantiate it per type
  • Assemble a small program that reads records, sorts them and prints a report

Prerequisites

  • No C++ at all — the course starts at the first program
  • Skill with any other language makes the early chapters quicker, but none is assumed

Course Content

  1. 01
    Your first C++ program

    What C++ is, what the compiler does before your program runs, and the smallest complete program: one function, a few lines of output, and a run.

    Beginner · 13 min read

    Not started
  2. 02
    Values, types and const

    Naming values in C++: the everyday types, what whole-number division does, why a const is a promise you make to the compiler, and what auto is for.

    Beginner · 15 min read

    Not started
  3. 03
    Decisions and loops

    Making the program choose between paths, and repeating work with for and while — plus the two words that steer a loop from inside.

    Beginner · 16 min read

    Not started
  4. 04
    Functions, defaults and overloading

    Naming a piece of work so it can be reused: the return type, the parameters, the void function that prints instead of answering, and two ways to make one name serve several calls.

    Beginner · 16 min read

    Not started
  5. 05
    Text with std::string

    Text as a value you can measure, join, search and change a character at a time: the handful of string methods that cover nearly all real work.

    Intermediate · 16 min read

    Not started
  6. 06
    Lists with std::vector

    A list that grows while the program runs: adding, reading, replacing and walking it with a range-based for that cannot run off the end.

    Intermediate · 16 min read

    Not started
  7. 07
    References and pass by reference

    The single idea that explains most C++ function signatures: a reference is another name for a value that already exists, so a function can change the caller copy or read it without copying it.

    Intermediate · 17 min read

    Not started
  8. 08
    Lookup with std::map and std::set

    A value per key instead of a value per position, and a collection that simply refuses repeats — two tools that replace a great deal of searching by hand.

    Intermediate · 17 min read

    Not started
  9. 09
    Structs and classes

    Gathering related values into your own type, giving that type behaviour, and the three ideas you need to read anyone else class: the constructor, const methods, and private data.

    Advanced · 18 min read

    Not started
  10. 10
    Lambdas and the algorithm library

    Small functions written where they are used, and the handful of standard algorithms that turn a hand-written loop into one clear line: sort, find_if, count_if and transform.

    Advanced · 18 min read

    Not started
  11. 11
    Templates: one function, many types

    Writing a function once and letting the compiler make the version each type needs — the idea behind the whole standard library, shown with one small function.

    Advanced · 18 min read

    Not started
  12. 12
    Capstone: a score report

    A program that uses the whole course: records in a struct, a vector of them, an iterator walk, a sort with your own rule, a map that counts, and a formatted report.

    Advanced · 22 min read

    Not started