Getting Started

Introduction to C++

Discover what C++ is, where it's used, why it matters, and how it compares to other languages — plus your first working C++ program.

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.

cpp
// Your first C++ program
#include <iostream>

int main() {
    std::cout << "Hello, C++!" << std::endl;
    return 0;
}
// Output: Hello, C++!

A Brief History

YearMilestone
1979Bjarne Stroustrup begins "C with Classes" at Bell Labs
1983Renamed to C++
1998First ISO standard — C++98
2011C++11 — major overhaul: move semantics, lambdas, auto, smart pointers
2014C++14 — refinements
2017C++17 — structured bindings, std::filesystem, parallel algorithms
2020C++20 — concepts, coroutines, modules, ranges
2023C++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 drivers

C++ vs Other Languages

FeatureC++PythonJavaC
Speed★★★★★★★★★★★★★★★
Memory controlManual (or smart ptrs)GCGCManual
Type systemStatic, strongDynamicStatic, strongStatic
Learning curveSteepGentleModerateModerate
OOP supportFullFullFullNone
Template/genericsPowerfulDuck typingGenericsNone
Standard libraryRich (STL)ExtensiveExtensiveMinimal
Primary useSystems, gamesScripting, MLEnterpriseSystems, 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 overhead

This is why C++ programs start fast and run fast: the compiler has already done all the translation work.


What You Can Build

cpp
#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: 2

Summary

  • 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.