What Is C++?
C++ is a compiled, statically typed, general-purpose language that turns source code into machine code before the program runs.
Connect compiled execution, abstractions and resource control in a small C++ program.
Imagine you are building Rocket Run, a small arcade game: a rocket dodges asteroids, collects coins and tries to beat a high score. It must redraw the screen dozens of times a second on anything from a gaming PC to a cheap laptop. That kind of job is exactly what C++ was designed for, and Rocket Run will be our example for the whole course.
The rule
C++ is translated to machine code before it runs, and checked on the way.
Three ideas are packed into that line.
- Compiled. A program called a compiler reads your source file and translates it into machine code, the instructions your processor executes directly. The finished program runs without the compiler.
- Checked. Every variable has a type fixed in the source, such as
intfor whole numbers. The compiler checks all of them before producing anything. This is called static typing. - General purpose, many styles. You can write plain step-by-step functions, group data and behaviour into classes, or write generic code with templates. C++ lets you mix all three.
Here is the smallest piece of Rocket Run:
#include <iostream>
int main() {
int lives = 3;
std::cout << "Lives: " << lives << '\n';
}A little history helps the names make sense. Bjarne Stroustrup started the language at Bell Labs in 1979 as "C with Classes", and it was renamed C++ in 1983 (++ means "add one" in C). Today an ISO committee publishes a new standard every three years: C++11, 14, 17, 20 and 23. This course uses C++17 and C++20.

