C++ · Learn
The C++ curriculum
A systems language with classes, templates and the Standard Template Library. The language of game engines, high-frequency systems and competitive programming. This path has 15 lessons in reading order, from the basics to the ideas that come up in real code, with a runnable example in every lesson.
- lessons
- 14 lessons
- hours of reading
- 2.3 hours of reading
- exercises to practise
- 0 exercises to practise
Beginner
8 lessons · about 70 minutes of reading, plus practice.
- C++ Syntax and Your First ProgramHow a C++ program is put together: #include, main(), statements, blocks and std::cout, plus how to compile and run it with g++ -std=c++17.8 min
- Variables and Types in C++Declaring C++ variables with int, double, char, bool and std::string, initialising them, using const and auto, and why an uninitialised variable is a bug.9 min
- Operators in C++C++ arithmetic, comparison, logical and assignment operators: integer division and modulo, prefix versus postfix ++, short-circuit evaluation and precedence.9 min
- Conditions in C++: if, else and switchHow C++ chooses between paths with if, else if and else, switch with break, the ?: operator and the C++17 if with an initialiser, with runnable examples.8 min
- Loops in C++: for, while and do-whileC++ loops explained: the three parts of a for loop, while and do-while, reading input until it ends, nested loops, and when to reach for break or continue.9 min
- Functions in C++Defining and calling C++ functions: return types, parameters, prototypes, pass by value versus by reference, default arguments and overloading, with examples.10 min
- Arrays in C++Declaring fixed-size C++ arrays, zero-based indexing, initialising, range-for loops, std::array, 2D arrays and why out-of-bounds access is undefined behaviour.10 min
- Strings in C++Working with std::string in C++: reading lines and words, length, indexing, concatenation, find and substr, comparison, changing case and converting numbers.10 min
Intermediate
5 lessons · about 60 minutes of reading, plus practice.
- Pointers and References in C++What C++ pointers and references are, how & and * work, when nullptr is useful, and how to let a function change the variable it was given.10 min
- Inheritance and Polymorphism in C++How a C++ class extends another, how virtual functions and override give run-time polymorphism, and why virtual destructors and slicing matter.12 min
- Templates in C++How C++ templates generate a function or class for each type you use, how type deduction works, and what C++17 adds with if constexpr and deduction guides.11 min
- Vectors in C++ (std::vector)How std::vector works in C++: creating and growing a vector, indexing with [] and at(), passing vectors to functions, erasing elements and building 2D grids.11 min
- Maps and Sets in C++How std::map and std::set store sorted keys in C++, how [] and find differ, how to count and look up safely, and when unordered_map is the better choice.12 min
Advanced
1 lessons · about 10 minutes of reading, plus practice.