C++ - Introduction

Overview

Estimated time: 20–30 minutes

C++ is a powerful systems programming language used for high-performance applications, games, embedded systems, and more. This introduction orients you to modern C++ (C++17/20/23), the standard library, and what you’ll learn next.

Learning Objectives

  • Describe what C++ is good at and where it’s commonly used.
  • Understand modern C++ standards and the role of the standard library (STL).
  • Know the immediate next steps: installing a toolchain and writing your first program.

Prerequisites

  • None. This is the first lesson.

Why C++?

  • Performance and control: value semantics, RAII, deterministic destructors.
  • Vast ecosystem: STL, Boost, and third-party libraries for practically any domain.
  • Portability across platforms and compilers.

Example

#include <iostream>
int main(){
  std::cout << "Hello, C++!\n";
  return 0;
}

Expected Output:

Hello, C++!

Common Pitfalls

  • Confusing old C++ (pre-11) with modern C++. We target C++20 features where helpful, and show pre-C++20 alternatives.
  • Skipping RAII: always prefer automatic resource management (smart pointers, containers) over manual new/delete.

Checks for Understanding

  1. What are typical use cases for C++?
  2. What is the STL?
Show answers
  1. High-performance apps, games, embedded, real-time systems, finance, and more.
  2. The Standard Template Library: containers, algorithms, iterators, and utilities shipped with C++.

Exercises

  1. Compile and run the sample program using your compiler (clang++, g++, or MSVC).
  2. Modify the program to print your name and a goal you have for learning C++.