Build with C++ · free core course + advanced labs

Learn C++ from zero, with nothing skipped.

Write C++, press Run, and see what it draws. Fifteen free modules that start from zero, then eight advanced modules on what C++ does underneath.

23 modulesFree and paid modulesHands-on labs
#include "scimigo.h"
using namespace scimigo;

int main() {
    canvas(600, 400);
    std::string eye_color = "green";
    rectangle(200, 100, 200, 180, "orange");
    circle(260, 170, 15, eye_color);
    circle(340, 170, 15, eye_color);
    text(235, 60, "My Robot", 28);
}
My Robot
Compiles real C++ with clang in your browser. The first load is about 17 MB.

Your Learning Path

Parts 1 and 2 teach C++ from nothing, up to a game you build yourself. Part 3 is the advanced track: what C++ does underneath, and the data structures and patterns behind efficient programs. Its labs use an earlier version of the lab page, so they look a little different.

Part 1 · Programs7 modules · free

1

Your First Program — A robot, then a sign with a printed caption

By the end you can read a short program statement by statement and say what it draws and prints, change and add calls, and use a compiler message to find the line that is wrong.

You build: A robot, then a sign with a printed caption

  • A program is a list of statements
  • One call, taken apart
  • Where is (x, y)?
  • Numbers, and text in quotes
  • Printing with std::cout
  • The frame around your statements
  • When the compiler says no
FreeReading materialInteractive lab
2

Values and Types — A sunset controlled by three variables; a receipt

By the end you can declare int, double and std::string variables, say what value every name holds after each statement, predict what / and % give for whole numbers, and draw a picture controlled by variables.

You build: A sunset controlled by three variables; a receipt

  • C++ as a calculator
  • A variable is a type, a name and a value
  • Printing values
  • A new value for an old name
  • Read, work out, store
  • Whole numbers and numbers with a fraction
  • Dividing whole numbers
  • Text in a variable
  • Values that must not change
  • How big can an int get?
FreeReading materialInteractive lab
3

Input and Output — A calculator that asks; a receipt in aligned columns

By the end you can read numbers, words and whole lines from input, explain and fix a line that comes back empty after a number, print money with two decimal places and tables in columns, and name the header a library feature comes from.

You build: A calculator that asks; a receipt in aligned columns

  • A program that waits
  • Where input comes from in the lab
  • Several values
  • Words and whole lines
  • The line end that stays behind
  • Naming the headers you use
  • Printing money
  • Columns
FreeReading materialInteractive lab
4

Decisions — A signal lamp; a menu that answers

By the end you can write conditions with comparisons and with and, or and not, choose among cases with if, else if and switch, test a rule at its boundaries, and check that a read worked.

You build: A signal lamp; a menu that answers

  • Questions with a yes or no answer
  • if
  • else
  • A chain of choices
  • One = too few
  • Both, either, not
  • Where a variable ends
  • switch
  • Did the read work?
FreeReading materialInteractive lab
5

Loops — A checkerboard; a staircase; the sum of whatever is typed

By the end you can read any while, for or do-while loop and say how many times it runs and what each variable holds on every turn, write counting loops, totals and nested loops, and read values until the input runs out.

You build: A checkerboard; a staircase; the sum of whatever is typed

  • The same statement, many times
  • while
  • Start, test, update
  • for
  • Ten or eleven?
  • Adding up as you go
  • A loop inside a loop
  • Leaving early and skipping
  • Test at the end
  • Until the input runs out
FreeReading materialInteractive lab
6

Functions — A street of houses drawn by functions the learner wrote from the first line to the last

By the end you can write a whole function from its first line to its last, pass values in and hand a value back, say why changing a parameter does not change the caller's variable, and split a program into functions that each do one job.

You build: A street of houses drawn by functions the learner wrote from the first line to the last

  • A name for some statements
  • Inputs
  • Giving a value back
  • The function works on a copy
  • Functions that return nothing
  • Each call has its own variables
  • Telling the compiler first
  • One name, several versions
  • A usual value
FreeReading materialInteractive lab
7

Testing and Debugging — A set of tests that catches four planted bugs

By the end you can tell the three kinds of error apart, decide what a function should return before running it, write a test function that catches planted bugs, and find a wrong value by watching it change.

You build: A set of tests that catches four planted bugs

  • Three ways to be wrong
  • Decide the answer first
  • Where programs break
  • assert
  • A function that tests a function
  • Two bugs you cannot see
  • Looking inside a running program
  • What a function promises
FreeReading materialInteractive lab

Part 2 · Data8 modules · free

8

Strings — A Caesar cipher; a letter histogram

By the end you can work with text one character at a time: read and change the character at a position, loop over a string without stepping past its end, build new strings, compare and search them, and treat a letter as the number it is.

You build: A Caesar cipher; a letter histogram

  • One character
  • Letters are numbers
  • How long is a string?
  • The character at a position
  • A count that cannot go below zero
  • Visiting every character
  • Building a string
  • Comparing strings
  • Finding a piece and taking it out
  • Questions about a character
FreeReading materialInteractive lab
9

Vectors — A bar chart from typed numbers; a word inspector

By the end you can keep any number of values in a std::vector, read and change them by position, add to the end, visit every element with a range-based for, and write functions that take and return vectors.

You build: A bar chart from typed numbers; a word inspector

  • Many values under one name
  • Three ways to start a vector
  • The element at a position
  • A vector that grows
  • One past the end
  • Each element in turn
  • Letting the compiler name the type
  • A vector of strings
  • A function that returns a vector
FreeReading materialInteractive lab
10

References and Parameter Passing — Functions that change their caller's variables; a garden drawn from data passed without copying

By the end you can say whether a function works on a copy or on the caller's own variable, write parameters that change their caller, pass strings and vectors without copying them, and choose between a value, a reference and a const reference.

You build: Functions that change their caller's variables; a garden drawn from data passed without copying

  • Another name for the same variable
  • A parameter that is the caller's variable
  • Looking without copying
  • Changing the elements of a vector
  • Exchanging two variables
  • More than one result
  • Which kind of parameter?
FreeReading materialInteractive lab
11

Grids, Searching and Sorting — A sorting replay, pass by pass; a maze map read from text

By the end you can store a grid as rows of cells, search a vector one element at a time and by halving a sorted range, write selection sort and bubble sort yourself, and count comparisons to see how the work grows.

You build: A sorting replay, pass by pass; a maze map read from text

  • Rows of cells
  • Looking at each element in turn
  • The smallest, and where it is
  • Selection sort
  • Bubble sort
  • Halving the range
  • Counting the work
  • The library's sort
FreeReading materialInteractive lab
12

Recursion — Circles inside circles; the Towers of Hanoi, move by move

By the end you can read a function that calls itself by writing out its calls, find the case that stops it, write recursive functions for numbers, strings, vectors and pictures, and say when a loop is the better choice.

You build: Circles inside circles; the Towers of Hanoi, move by move

  • Calls that wait
  • A function that calls itself
  • The case that stops
  • Before the call, and after it
  • Writing out the calls
  • Two calls each
  • A loop or a recursion?
  • When it never stops
FreeReading materialInteractive lab
13

Structs and Enums — The model of a Tic-Tac-Toe board

By the end you can define your own types with struct and enum class, pass them to functions and keep them in vectors, compare two of them with a function you write, and model the state of a small game.

You build: The model of a Tic-Tac-Toe board

  • Values that belong together
  • One member at a time
  • Giving every member a value
  • Passing a struct to a function
  • Many of them
  • A type with a few named values
  • Structs inside structs
  • Are two structs equal?
FreeReading materialInteractive lab
14

Files and String Streams — A score table loaded from a file, sorted, and saved to another

By the end you can read a file with the tools you already use for typed input, check that it opened, write results to another file, take a line of text apart into values, and write one function that works for the keyboard and for a file.

You build: A score table loaded from a file, sorted, and saved to another

  • Reading from a file
  • The file that is not there
  • A file, line by line
  • Writing a file
  • One function for the keyboard and for a file
  • Taking a line apart
  • Numbers and text
FreeReading materialInteractive lab
15

Project: Tic-Tac-Toe — A playable game with a computer opponent

By the end you have built a complete Tic-Tac-Toe game: a board model, functions that find a winner and the state of play, a picture that answers clicks, and a computer opponent that tries its moves on a copy of the board.

You build: A playable game with a computer opponent

  • A game is a few small functions
  • A value, or nothing
  • Winning lines as data
  • How does the game stand?
  • A function the lab calls
  • State first, picture second
  • Trying a move on a copy
FreeReading materialInteractive lab

Part 3 · Advanced track8 modules · free lessons, paid labs

16

Objects, Lifetime & RAII — See when objects begin and end

A constructor acquires and a destructor releases, so cleanup happens on every way out of a scope. Watch lifetimes on a timeline, see each copy as an object of its own, close files on every exit, and build a type that is moved but never copied.

You build: A move-only owning type, and a session that restores its settings on every exit

  • constructors and destructors
  • scope lifetime
  • RAII
  • copy and move
  • Rule of Zero
Free lesson · Paid lab130 minReading materialGuided lab
17

Pointers and Ownership — Who points at an object, and who is responsible for it

A pointer says where an object is, not who keeps it alive. Find a leak, then let unique_ptr, shared_ptr and weak_ptr say who owns an object and who only borrows it, and break a reference cycle.

You build: A dispatch desk where every job has exactly one owner

  • pointers and nullptr
  • new and delete
  • unique_ptr
  • shared_ptr and weak_ptr
  • borrowing
Free lesson · Paid lab110 minReading materialGuided lab
18

How std::vector Really Works — See the buffer behind the vector

Size is not capacity. Watch a vector move to a bigger buffer, catch a pointer that went stale, build a growing vector of your own, count why doubling keeps total copying linear, and tell copying an element from moving it.

You build: A vector that grows its own buffer, and a reception board that never shifts its cells

  • size and capacity
  • reallocation
  • invalidation
  • amortized cost
  • copy, move and emplace
Free lesson · Paid lab140 minReading materialGuided lab
19

STL: Containers & Algorithms — Choose the right container, and let the standard algorithms do the work

Choose a container by the questions a program asks of it, sort with a lambda and a comparator that is a strict weak ordering, replay a binary search with lower_bound, and solve a problem with the standard library instead of hand-written loops.

You build: A departure board that keeps the newest update for every stop, in order

  • container choice
  • ranges and lambdas
  • strict weak ordering
  • captures
  • lower_bound
Free lesson · Paid lab140 minReading materialGuided lab
20

Interview Patterns in C++ — Four ways to avoid trying everything

Binary search, two pointers moving inward, a sliding window and breadth-first search, each with the condition that makes it correct, a counter that shows the work it saves, and the C++ traps: integer overflow, unsigned underflow and needless copies.

You build: Search, window and maze solvers, and the longest batch that fits a limit

  • binary search
  • two pointers
  • moving interval
  • breadth-first search
  • overflow traps
Free lesson · Paid lab120 minReading materialGuided lab
21

Dynamic Programming & Capstone — Remember answers, fill tables, and walk back along them

Stop asking the same question twice with a memo, fill a table in dependency order, build the tables for a longest increasing subsequence, and walk back along them to recover the choices. The mastery challenge does not say it is dynamic programming.

You build: Memoized and tabulated solutions that recover their choices, and an exact supply-pack planner

  • memoization
  • table state
  • correctness proof
  • reconstruction
  • pseudo-polynomial cost
Free lesson · Paid lab140 minReading materialGuided lab
22

Trees and Ordered Search — Keep keys in order while they change

Grow a binary search tree whose unique_ptr nodes own their children, walk it in four orders, remove keys in all three cases, and measure how arrival order decides its height. Then see why std::set and std::map stay logarithmic.

You build: A search tree you grow, walk and prune, and a rescue log that finds the nearest boat

  • search-tree order
  • tree ownership
  • traversals
  • erase
  • height and balance
Free lesson · Paid lab135 minReading materialGuided lab
23

Stacks, Heaps and Priority Queues — Always know what comes next

Keep a stack in order to answer nearest-taller questions in one pass, store a heap in a vector and repair it with sift up and sift down, keep the k largest of a stream with std::priority_queue, and measure why building a heap bottom-up is linear.

You build: A skyline solver, a heap you repair by hand, and a merge of hundreds of sorted logs

  • std::stack
  • monotonic stacks
  • binary heaps
  • std::priority_queue
  • bottom-up building
Free lesson · Paid lab135 minReading materialGuided lab

Who this course helps

  • College students taking a first programming course in C++
  • People who have never written a program
  • Learners who know some Python or Java and want C++ from the ground up

A playable Tic-Tac-Toe game with a computer opponent, built from functions you tested

  • Read a program and say what it will do before running it
  • Write and test programs with input, decisions, loops, functions, strings, vectors and files
  • Build a playable Tic-Tac-Toe game with a computer opponent

Every idea is taught before it is used, every lab asks you to predict before you run, and every task is checked against the mistakes people really make.

About This Course

Build with C++ starts from nothing: no programming experience is assumed, and nothing is used before a lesson has explained it.

Every free module is a short written lesson and then a lab that runs in your browser. In the lab you first predict what a program will do, then change one, then write your own. Your C++17 is compiled by clang on the page: your program draws on a canvas, prints, reads input and files, and checks tell you whether it is right. You can step through a program line by line and see every value change.

Part 1, Programs, is seven modules: a first program, values and types, input and output, decisions, loops, functions, and testing and debugging. Part 2, Data, is eight more: strings, vectors, references, grids with searching and sorting, recursion, structs and enums, files, and a Tic-Tac-Toe project that uses all of it. Each module ends with homework to do on your own. No account, installation or local setup is needed.

The advanced track goes where C++ is different: object lifetime and RAII, pointers and ownership with unique_ptr, shared_ptr and weak_ptr, how std::vector really grows, the STL with lambdas and comparators, interview patterns, dynamic programming, binary search trees and what std::set and std::map are inside, and stacks, heaps and std::priority_queue. Every advanced lesson is free to read. One purchase unlocks the guided labs: 40 exercises and 208 compiled checks that say what your code got wrong, panels that draw lifetimes, owners, buffers, trees and heaps from your own program, work counters that catch a loop doing more than it needs to, and eight mastery challenges where nobody names the technique and you write your plan before you code.

Prerequisites

  • No programming experience required

What You Will Learn

  • Read a short C++ program and say what it will do before running it
  • Write programs with variables, input and output, decisions, loops and functions
  • Work with strings, vectors, structs and files, and pass data to functions without copying it
  • Write searches, sorts and recursive functions yourself, and build a small game from tested parts
  • Read a compiler message, test a function at its boundaries, and find a bug by watching values change
  • Give every resource one owner with RAII, unique_ptr and shared_ptr, and say when a pointer only borrows
  • Choose an STL container and algorithm for a problem, and know what std::vector, std::set, std::map and std::priority_queue do inside

Build with C++: frequently asked questions

Do I need to install a compiler?

No. Your code is compiled by clang inside your browser, so there is nothing to install, and the free modules need no account. Nothing is sent to a server.

Is it real C++?

Yes. The exercises are standard C++17, compiled by clang 21 to WebAssembly and run on the page. Programs include the standard headers they use, just as they would on your own computer. The drawing instructions such as canvas, rectangle and circle come from a small header made for this course.

Is Build with C++ free?

The fifteen core modules are free, lessons and labs, with no account or payment. Every advanced lesson is free to read too. A one-time purchase unlocks the guided labs of the eight advanced modules.

What does the purchase include?

The guided labs for modules 16–23: object lifetime and RAII, pointers and smart pointers, how std::vector grows, the STL, interview patterns, dynamic programming, search trees, and stacks and heaps. That is 40 exercises with 208 checks, compiled with your code, that say what it got wrong (such as a resource released twice, a pointer kept across a reallocation, or a heap whose parent is smaller than its child); panels that draw object lifetimes, owners, vector buffers, trees and heaps from your own program; and work counters that catch a solution doing more work than it needs to. Each module ends with a mastery challenge that does not name its technique: you write down your plan and its invariant before you code. Every exercise has hints and a worked solution. It is a one-time purchase, not a subscription.

Can I learn C++ as my first language?

Yes. No programming experience is required. Module 1 starts with a single drawing instruction and takes it apart, and each module uses only what the ones before it taught.

How long does the course take?

The free modules have not been timed with learners yet. Each one is a lesson, ten or so guided activities and a set of homework, so plan on a few hours per module. The advanced track adds about 17 hours, roughly two hours per module for the lesson and its lab. The first run of a session downloads the compiler, so it takes a little longer than the runs after it.

What will I build?

In the free modules: a robot, a sunset controlled by three variables, a receipt in aligned columns, a checkerboard, a street of houses drawn by your own functions, a Caesar cipher, a bar chart, a sorting replay, the Towers of Hanoi, a score table read from a file, and a playable Tic-Tac-Toe game with a computer opponent. In the advanced labs: a move-only owning type, a dispatch desk whose jobs have exactly one owner, a vector that grows its own buffer, a departure board built from STL algorithms, binary-search, sliding-window and breadth-first solvers, dynamic-programming solutions that recover their choices, a search tree you grow, walk and prune, and a heap that merges hundreds of sorted logs.

How is this different from other C++ tutorials?

Most activities ask you to predict what a program will do before you run it. Then you can step through it line by line and see every value change, and checks tell you what your own code got wrong. The aim is that you can say why a program does what it does.

Module 1: Your First Program

A robot, then a sign with a printed caption. No installation and no account needed. Your work is saved in this browser.

Start module 1 — free