</>CodexBash
All tutorials

C++ tutorial

C with power tools: vectors, strings, maps and classes, and fast enough for anything.

  1. 01Your first C++ programWhat C++ is, the shape of a C++ program, compiling with g++, printing with cout, and reading compiler errors.8 min
  2. 02Variables and data typesC++'s number, character and text types, overflow and long long, auto, const, and converting between types safely.10 min
  3. 03Operators and reading inputArithmetic, remainder and increment, comparisons and logic, reading values with cin, reading whole lines with getline, and fast input.10 min
  4. 04StringsThe string type, indexing and length, changing strings in place, substr, find, comparing, converting to and from numbers, and walking a string character by character.10 min
  5. 05Decisions with if and switchChoosing what runs with if, else if and else, initialising inside an if, the ternary operator, and switch with its break.8 min
  6. 06LoopsThe counting for loop, the range-based for over a collection, while and do while, break and continue, and the costs and off-by-one errors that matter in practice.9 min
  7. 07Functions and referencesWriting functions, passing by value, by reference and by const reference, default arguments, overloading, and returning several values with a pair.11 min
  8. 08Vectors and the standard algorithmsThe vector, C++'s growable array: creating, reading, adding and removing, two-dimensional vectors, sorting, and the standard algorithms that replace hand-written loops.12 min