Introduction to C++
C++ is one of the most powerful and widely used programming languages ever created. Born as an extension of C in the early 1980s, it adds object-oriented programming, generic programming, and a rich standard library — while preserving C's raw performance and low-level control. Today C++ runs inside operating systems, game engines, browsers, financial trading systems, and embedded devices where every microsecond counts.
What Is C++?
C++ is a statically typed, compiled, general-purpose programming language. Every variable has a type decided at compile time, and the source code is translated directly into machine instructions — there is no interpreter or virtual machine sitting between your code and the CPU.
// Your first C++ program
#include <iostream>
int main() {
std::cout << "Hello, C++!" << std::endl;
return 0;
}
// Output: Hello, C++!A Brief History
| Year | Milestone |
|---|---|
| 1979 | Bjarne Stroustrup begins "C with Classes" at Bell Labs |
| 1983 | Renamed to C++ |
| 1998 | First ISO standard — C++98 |
| 2011 | C++11 — major overhaul: move semantics, lambdas, auto, smart pointers |
| 2014 | C++14 — refinements |
| 2017 | C++17 — structured bindings, std::filesystem, parallel algorithms |
| 2020 | C++20 — concepts, coroutines, modules, ranges |
| 2023 | C++23 — further standard library additions |
Note: This course targets C++17, which is the most widely supported modern standard in production environments.
Where C++ Is Used
Game Engines → Unreal Engine, Unity (core engine), CryEngine
Operating Systems → Windows kernel, parts of macOS/Linux
Browsers → Chrome (V8 JS engine), Firefox (Gecko)
Databases → MySQL, MongoDB, RocksDB
Finance → High-frequency trading, risk engines
Embedded Systems → Automotive ECUs, medical devices, firmware
Compilers → Clang, GCC themselves are written in C++
Graphics → OpenGL, DirectX, Vulkan driversC++ vs Other Languages
| Feature | C++ | Python | Java | C |
|---|---|---|---|---|
| Speed | ★★★★★ | ★★ | ★★★ | ★★★★★ |
| Memory control | Manual (or smart ptrs) | GC | GC | Manual |
| Type system | Static, strong | Dynamic | Static, strong | Static |
| Learning curve | Steep | Gentle | Moderate | Moderate |
| OOP support | Full | Full | Full | None |
| Template/generics | Powerful | Duck typing | Generics | None |
| Standard library | Rich (STL) | Extensive | Extensive | Minimal |
| Primary use | Systems, games | Scripting, ML | Enterprise | Systems, embedded |
C++ occupies a unique position: it gives you Python-level abstraction capability through OOP and templates, while still letting you drop down to raw memory management when performance demands it.
The C++ Compilation Model
Unlike Python (which is interpreted line by line), C++ is fully compiled before running:
Source file (.cpp)
│
▼ Preprocessor (expands #include, #define)
Preprocessed code
│
▼ Compiler (translates to machine code)
Object file (.o / .obj)
│
▼ Linker (combines object files + libraries)
Executable (.exe / ELF binary)
│
▼ CPU runs directly — no runtime overheadThis is why C++ programs start fast and run fast: the compiler has already done all the translation work.
What You Can Build
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
// A taste of modern C++
int main() {
std::vector<std::string> languages = {
"C++", "Python", "Rust", "Go", "Java"
};
// Sort alphabetically — one line
std::sort(languages.begin(), languages.end());
// Range-based for loop
for (const auto& lang : languages) {
std::cout << lang << "\n";
}
// Lambda + algorithm
auto cpp_only = std::count_if(
languages.begin(), languages.end(),
[](const std::string& s) { return s[0] == 'C'; }
);
std::cout << "Languages starting with C: " << cpp_only << "\n";
return 0;
}
// Output:
// C++
// Go
// Java
// Python
// Rust
// Languages starting with C: 2Summary
- C++ is a compiled, statically typed, multi-paradigm language created by Bjarne Stroustrup in 1983
- It combines low-level memory control with high-level abstraction through OOP and templates
- C++ powers games, operating systems, browsers, databases, and embedded systems
- The C++11/14/17/20 standards modernised the language significantly — modern C++ is safer and more expressive than the C++ of the 1990s
- C++ compiles directly to machine code — programs run without an interpreter or virtual machine
- The learning curve is steeper than Python, but the performance ceiling is much higher
Next, we'll set up your C++ development environment so you can compile and run programs on your machine.