Set up your courses
Pick the courses you're taking and this page shows only those. About 30 seconds.
Code, one block at a time.
Short lessons: predict first, try it in a model, then see why it works.
Start the first lessonNo sign-up. Your progress saves on this device, and you can keep it later with an email.
Know some c++ already?
Answer about 10 questions and skip the units you know. New to it? Start with the first lesson below.
First programs and the build
Read the parts of a complete C++ program, predict exactly what cout prints, read a g++ message to find the real mistake, and tell a compile error from a linker error from a run-time error.
Formulas: First programs and the buildVariables, types and arithmetic
Declare variables of type int, double, char and bool, predict what integer division, mixed types, overflow and rounded doubles do, and say what undefined behavior means.
Input, output and math
Read numbers, words and whole lines with cin and getline, print doubles to set decimal places and in lined-up columns, notice input that cin can't read, and use the cmath functions in a complete read, compute, print program.
Decisions
Write if, if/else and else-if chains, read g++'s warnings about = and stray semicolons, combine conditions with &&, || and !, guard risky tests, compare doubles with a tolerance, and write a switch with break.
Loops
Trace while, for and do-while loops and say how many times each block runs, find off-by-one bounds, stray semicolons and loops that never end, count nested loops, and build counters, totals and best-so-far values.
Functions
Define and call functions with typed parameters and return values, declare them before use, tell return from cout, say where variables live, pass by value and by reference, use default arguments and overloading, trace recursion, and test a function with assert.
Arrays
Declare, index and walk fixed-size arrays from 0, copy and compare them element by element, pass them to functions, search them, use two-dimensional arrays and sort with selection sort, knowing that nothing checks an index.
Vectors
Create and grow vectors, walk them with range-based for loops, copy and share them on purpose, read safely with at(), pass them to functions by the right kind of parameter, sort and binary-search them, and remove elements without skipping any.
Strings and characters
Change, cut, search, join and compare strings, convert between text and numbers, treat characters as codes, and read and compare C-strings.
Pointers and references
Read addresses, declare and dereference pointers, use nullptr, pass pointers to functions, step through arrays with pointers, allocate with new and free with delete, compare references with pointers, and say when memory's lifetime ends.
Structs and classes
Group values in structs, write classes with private data, constructors and const member functions, read a class split across files, predict when objects begin and end, and keep objects in vectors.
Files and streams
Write and append to text files, open files for reading and check that they opened, read until the data runs out, read lines and records, split lines with a stringstream, and write formatted reports.