C++ Basics
Lesson 1 / 19
Pito
What C++ is and where it's used
A fast language: games, browsers, robots; compilation; where to practise
Chapter 1. C++ basics
15 minutes
4 questions
C++ is a fast programming language that lets you control the computer's memory directly. It was created by the Danish computer scientist Bjarne Stroustrup as an extension of C; its first official release came out in 1985.
Where it's used
| Field | Example |
|---|---|
| Games | the Unreal Engine game engine is written in C++ |
| Browsers | large parts of Chrome and Firefox |
| Robotics and devices | code for Arduino boards is based on C++ |
| Where speed matters | financial systems, databases, 3D graphics |
| Competitions | one of the most popular languages in programming olympiads |
How it differs from Python
| Python | C++ | |
|---|---|---|
| Running | an interpreter — line by line | compilation: first turned into machine code |
| Speed | slower | much faster |
| Types | x = 5 — type is automatic |
int x = 5; — the type is written out |
| End of statement | a new line | a ; semicolon |
| Blocks | indentation | { } curly braces |
Compilation
program.cpp ──g++──▶ program (an executable file) ──▶ output
- You write the code in a
program.cppfile. - The compiler (
g++) turns it into machine code:g++ program.cpp -o program - You run the resulting file:
./program(program.exeon Windows).
If there's a mistake, the compiler tells you before the program runs — one of C++'s strengths.
Where to practise
This site's editor doesn't run C++ — the examples and their output are shown in the lesson. To practise yourself:
- On your computer:
g++via MinGW-w64 or WSL (Ubuntu) on Windows; VS Code or Code::Blocks as the editor. - Online: free in-browser online compilers (for example OnlineGDB or Compiler Explorer) — nothing to install.
💡 If you know Python, C++ is much easier: loops, conditions and functions are the same ideas — just written more strictly.