What Is C++ and Why Compile?
C++ is a compiled, statically typed language for software where performance and control matter. Understand what the compiler does before you write your first line.
C++ is a compiled language: before your program runs, a program called the compiler translates your human-readable source code (.cpp files) into machine code your CPU executes directly. That translation step is what makes C++ fast — and it is also why C++ catches certain mistakes before the program ever runs.
The workflow you will repeat thousands of times
edit code → compile → run → (read output or errors) → repeat
Compare that with Python, where the interpreter reads your source directly. In C++, two different tools answer two different questions:
- The compiler (
g++) turns source into an executable and refuses to build code it cannot understand. A compiler error means "this is not valid C++". - The runtime is your program actually executing. A runtime error (a crash) means valid C++ did something dangerous, like dividing by zero or reading past the end of a collection.
Why learn C++ in 2026?
- It runs everywhere performance matters: games, browsers, databases, operating systems, embedded devices, trading systems.
- It teaches you what the machine is really doing: memory, lifetime, and cost. That knowledge makes you better at every language.
- Modern C++ (C++20 is this course's baseline) is a much safer, more expressive language than the C++ of the 1990s. This course teaches the modern language — not "C with classes".
What "statically typed" buys you
Every variable's type is known at compile time:
int score = 100; // the compiler knows this is a whole number
double price = 9.99; // ...and this is a decimal
If you later write score = "high"; the compiler stops you with an error — in Python the same mistake would explode at runtime, possibly in production, possibly on a Tuesday night. Types are a feature, and you will learn to lean on them.
A note on the platform
In this course you write C++ in the browser editor and the platform compiles and runs it in an isolated sandbox using GCC. The graded programs follow one convention you will meet in the next lesson: your code is compiled as a single file, and interactive keyboard input is not part of grading — challenges check what your functions return and what your program prints.
Coming up: your first program, and the strange little word main.