Learn modern C++ (C++17 with G++ 15) from your first std::cout to classes, the STL and templates, ending with a gradebook project, with every exercise checked as you go.
15 lessons, 29 exercises. Runs C++ G++ 15.
Not started
Hello, output
Write your first C++ program, print text and numbers with std::cout, add comments, and see how a compiled program runs.
Values and variables
Store numbers, text and true/false values in typed variables, use brace initialization and auto, and lock values with const and constexpr.
Reading input and arithmetic
Read numbers and words from standard input with std::cin, calculate with C++'s operators, and format decimal output.
Making decisions
Branch with if, else and switch, combine conditions with comparison and logical operators, and keep variables tightly scoped with if-initializers.
Loops
Repeat work with for, while, do-while and range-based for loops, read input until it runs out, and leave loops early with break and continue.
Functions
Write functions with parameters and return values, choose between passing by value, by reference and by const reference, and use overloading and default arguments.
Collections
Keep lists of values in std::vector and key-value pairs in std::map, and loop over both safely.
Strings and a small project
Read whole lines with std::getline, search, slice and transform std::string, split text with string streams, and build a small text statistics tool.
Handling errors
Signal and handle failures with exceptions, use the standard exception types, parse numbers safely with std::stoi, and return std::optional when "no result" is normal.
Structuring data with classes
Group data and behaviour into structs and classes, protect invariants with private members and constructors, mark read-only member functions const, and overload operators.
Recursion
Solve problems by having a function call itself on smaller inputs, write solid base cases, and use recursion for branching searches and nested data.
Sorting and searching
Sort containers with std::sort and custom comparisons written as lambdas, keep ties in order with std::stable_sort, and search sorted data with binary_search, lower_bound and upper_bound.
Maps and sets in depth
Count and group with std::map and std::unordered_map, keep unique values in std::set, and combine sets with the standard set algorithms.
The STL and templates
Write generic code with function and class templates, and replace hand-written loops with STL algorithms, iterators and lambdas.
Final project: gradebook
Combine classes, containers, algorithms, exceptions and string parsing into a command-driven gradebook program.
Your progress is saved in this browser. Sign in to keep it on every device.