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
- 01Your first C++ programNot started
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.
- 02Values, types and constNot started
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.
- 03Decisions and loopsNot started
Making the program choose between paths, and repeating work with for and while — plus the two words that steer a loop from inside.
- 04Functions, defaults and overloadingNot started
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.
- 05Text with std::stringNot started
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.
- 06Lists with std::vectorNot started
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.
- 07References and pass by referenceNot started
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.
- 08Lookup with std::map and std::setNot started
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.
- 09Structs and classesNot started
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.
- 10Lambdas and the algorithm libraryNot started
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.
- 11Templates: one function, many typesNot started
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.
- 12Capstone: a score reportNot started
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.
