C++, made easy.

A free, friendly guide to C++ for total beginners. Short lines. Plain words. A tiny example for every idea.

Go one lesson at a time. Each lesson is split into small boxes โ€” read one box, try the code, then move on. You do not need to remember everything. Come back anytime.

#include <iostream> int main(){    std::cout << "Hello, world!\n";    return 0;}
Your progress
๐ŸŽ“ Certificate
โœ“ = lessons you marked as done๐Ÿ“ฆ Every lesson ends with a short quiz or summaryโŒจ Press / to search
Chapter 0

Getting started

What coding is, what C++ is, and how to run your very first program.

  1. 0.1How this guide works
  2. 0.2What is a program?
  3. 0.3What is C++?
  4. 0.4Compiling: turning code into a program
  5. 0.5Setting up your tools
  6. 0.6Your first program
  7. 0.7When it does not work
Chapter 1

C++ basics

Statements, printing, comments, variables, reading input and simple math.

  1. 1.1Statements and the main function
  2. 1.2Printing with std::cout
  3. 1.3Comments
  4. 1.4Variables: a labeled box
  5. 1.5Giving variables a value
  6. 1.6Reading input with std::cin
  7. 1.7Uninitialized variables
  8. 1.8Naming things
  9. 1.9Simple math
  10. 1.xChapter 1 summary and quiz
Chapter 2

Types of data

Whole numbers, decimals, true/false, characters, text, and values that never change.

  1. 2.1What is a type?
  2. 2.2Whole numbers (int)
  3. 2.3Decimal numbers (double)
  4. 2.4True or false (bool)
  5. 2.5Single characters (char)
  6. 2.6Text (std::string)
  7. 2.7Values that never change (const)
  8. 2.8Changing types (casting)
  9. 2.xChapter 2 summary and quiz
Chapter 3

Operators

Math, shortcuts, comparing things, and combining yes/no questions.

  1. 3.1Math operators
  2. 3.2Shortcuts for changing numbers
  3. 3.3Comparing things
  4. 3.4And, or, not
  5. 3.5Which goes first? (precedence)
  6. 3.xChapter 3 summary and quiz
Chapter 4

Making choices

Let your program decide what to do with if, else and switch.

  1. 4.1if: make a choice
  2. 4.2else and else if
  3. 4.3switch: many choices
  4. 4.4Common if mistakes
  5. 4.xChapter 4 summary and quiz
Chapter 5

Repeating things (loops)

while, for, break and continue โ€” plus random numbers and a guessing game.

  1. 5.1while loops
  2. 5.2for loops
  3. 5.3break and continue
  4. 5.4do-while loops
  5. 5.5Loops inside loops
  6. 5.6Random numbers
  7. 5.xChapter 5 summary and quiz
Chapter 6

Functions

Save a set of steps under a name, give it inputs, and get answers back.

  1. 6.1What is a function?
  2. 6.2Giving back a value (return)
  3. 6.3Inputs: parameters
  4. 6.4Where variables live (scope)
  5. 6.5Declare before you use
  6. 6.6Same name, different inputs (overloading)
  7. 6.7Splitting code into files
  8. 6.xChapter 6 summary and quiz
Chapter 7

Fixing bugs (how not to get stuck)

Read error messages, find bugs step by step, and know what to do when you're stuck.

  1. 7.1Two kinds of errors
  2. 7.2Reading an error message
  3. 7.3The most common mistakes
  4. 7.4Printing to find bugs
  5. 7.5Using a debugger
  6. 7.6When you're stuck, do this
  7. 7.xChapter 7 summary and quiz
Chapter 8

Holding lots of data

Lists that grow (vector), fixed lists (array), text tools, and key-value maps.

  1. 8.1vector: a list that grows
  2. 8.2Going through a list
  3. 8.3vector tools
  4. 8.4Fixed-size lists (array)
  5. 8.5String tools
  6. 8.6map: look things up by name
  7. 8.xChapter 8 summary and quiz
Chapter 9

References and pointers

Share the same box (references), point at a box (pointers), and manage memory safely.

  1. 9.1Memory and addresses
  2. 9.2References: another name for the same box
  3. 9.3Passing by reference
  4. 9.4Pointers: a note with an address
  5. 9.5nullptr: pointing at nothing
  6. 9.6Dynamic memory and smart pointers
  7. 9.xChapter 9 summary and quiz
Chapter 10

Grouping data: enums, structs and classes

Make your own types: named options, groups of values, and objects with behaviour.

  1. 10.1enum class: a set of named options
  2. 10.2struct: a group of values
  3. 10.3Classes: objects with behaviour
  4. 10.4Constructors: setting up an object
  5. 10.5Keeping data safe (encapsulation)
  6. 10.xChapter 10 summary and quiz
Chapter 11

Going further

Templates, algorithms, inheritance, exceptions and files โ€” your next steps.

  1. 11.1Templates: code for any type
  2. 11.2The algorithm toolbox
  3. 11.3Inheritance: building on a class
  4. 11.4Exceptions: handling errors
  5. 11.5Reading and writing files
  6. 11.xChapter 11 summary and where to go next
Chapter 12

Power tools and projects

Operator overloading, move semantics, lambdas, threads โ€” and two full projects to build.

  1. 12.1Operator overloading
  2. 12.2Move semantics
  3. 12.3Lambdas in depth
  4. 12.4Project: a text adventure game
  5. 12.5Project: a to-do list app
  6. 12.6Intro to multithreading
  7. 12.xChapter 12 summary and quiz
Chapter 13

Reverse engineering basics

Look inside compiled programs: read assembly, use a disassembler and debugger, and crack your own crackme โ€” safely and legally.

  1. 13.1What is reverse engineering?
  2. 13.2From C++ to a program file
  3. 13.3Registers and instructions
  4. 13.4Functions in assembly
  5. 13.5if statements and loops in assembly
  6. 13.6Structs and classes in memory
  7. 13.7Your reverse engineering toolbox
  8. 13.8Project: make and crack your own crackme
  9. 13.9Where to practise legally
  10. 13.xChapter 13 summary and quiz
Appendix P

Practice problems

Extra exercises with hints and answers. โญ = easy, โญโญ = medium, โญโญโญ = challenge.

  1. P.1Warm-up problems (chapters 1โ€“4)
  2. P.2Building skills (chapters 5โ€“8)
  3. P.3Challenge projects (chapters 9โ€“12)
  4. P.4Reverse engineering puzzles (chapter 13)
Appendix R

Quick reference

Look-up pages for the most-used tools. Short and to the point.

  1. R.1iostream: printing and reading
  2. R.2string functions
  3. R.3vector functions
  4. R.4algorithm functions
  5. R.5cmath: number tools
  6. R.6Cheat sheet