Courses · Beginner · a little programming helps

C++

C++ makes you say exactly what you mean: what type every value has, where it lives, who owns it and when it disappears. That's what makes it fast, and what makes it the language of so many university courses.

This course builds the mental models one at a time, and every program you write is compiled by a real compiler, with its real error messages explained.

Modules
16
Lessons
66
Time
~14 hours
Projects
3
Start free

What you'll be able to do

  • Read compiler errors and fix them
  • Choose types, and predict what integer division, conversions and overflow do
  • Write functions that take arguments by value and by reference, and know the difference
  • Use std::string and std::vector, and raw arrays when an exam asks for them
  • Explain where a variable lives, and trace pointers by hand
  • Manage memory with new and delete, and know why modern C++ avoids it
  • Design classes with constructors, methods and invariants

Who it's for

Students taking a C++ course or preparing for an exam, and anyone who wants to understand types, memory and pointers properly. If you've done some Python, you'll recognise the ideas and discover what Python was doing for you. If you haven't, the course starts from the first line.

What you need

None required. A laptop or desktop is recommended: the compiler runs in your browser and is a one-time download of about 20 MB. Reading, predictions and quizzes work on any device.

What you'll build

  • Café Receipt
  • Trip Calculator
  • Gradebook

Curriculum

First ProgramsCompile, run, read the errors. Types, input and output, decisions and loops. 6 modules · 24 lessons
  1. 0 Compile, Then RunYour first C++ program, and the compiler that stands between you and the machine.
  2. 1 Every Value Has a TypeVariables in C++ are typed boxes. The type decides what fits and what the operators do.
  3. 2 Talking to the UserReading input with cin and getline, and formatting what you print.
  4. 3 Decisionsif, else, switch, and the mistakes C++ lets you make without complaining.
  5. 4 Loopswhile, for and do-while, traced pass by pass.
  6. 5 Mastery Check: First ProgramsTypes, input, decisions and loops, mixed together. No new material.
Building BlocksFunctions, references, strings, vectors and arrays. Copies versus the real thing. 5 modules · 19 lessons
  1. 6 FunctionsDeclared before use, typed in and out, and given copies of what you pass.
  2. 7 ReferencesA second name for the same variable. How functions change what they are given.
  3. 8 Strings and VectorsThe two containers you'll use every day, and how to pass them around.
  4. 9 ArraysThe fixed-size, no-safety-net original. What exams ask, and what vectors protect you from.
  5. 10 Mastery Check: Building BlocksFunctions, references, strings, vectors and arrays, mixed. No new material.
Memory and ObjectsAddresses, pointers, the heap, and classes that manage their own resources. 5 modules · 23 lessons
  1. 11 PointersA variable that holds the address of another. Drawn, traced and demystified.
  2. 12 Memory You Manage YourselfThe stack, the heap, new and delete, and the three classic ways to get it wrong.
  3. 13 Structs and ClassesYour own types. Data, the functions that belong to it, and rules that can't be broken from outside.
  4. 14 The Standard Library and ExceptionsAlgorithms you don't have to write, containers that look things up, and errors that can't be ignored.
  5. 15 Final Assessment and ProjectThe whole course in one sitting, then a program that is entirely yours.