C++ · Beginner level

Beginner level · Module 1 of 5 · 10 guided hours

C++ Toolchain and First Programs

Install a compiler and editor, learn how source code becomes an executable, and write programs that calculate and print results.

Learning objectives

  • Install g++ (or Clang/MSVC) and an editor, and build from the terminal
  • Describe preprocessing, compiling and linking
  • Use fundamental types, operators and iostream output

Topics

  • compilers: GCC, Clang, MSVC
  • preprocess, compile, link
  • main and #include
  • int, double, char, bool, std::string
  • operators and integer division
  • std::cout and std::cin

Lessons

  1. Lesson 1 How C++ Becomes a Program

    Follow source code through preprocessing, compilation and linking to an executable, and see why C++ programs run fast.

    preprocessorcompilerlinkerexecutable

  2. Lesson 2 Setting Up the Compiler and Editor

    Install a compiler and an editor, build with warnings enabled and run programs from the terminal and the editor.

    g++ / clang++ / MSVC-Wall -Wextra-std=c++20terminal workflow

  3. Lesson 3 Types, Variables and Input/Output

    Store values in typed variables, calculate with operators and read and print values with iostream.

    int, double, bool, charstd::stringinteger divisionstd::cin and std::cout

Practical activity

Write a program that reads distance and fuel price and prints the cost of a trip between Juba and Nimule, built with warnings enabled.

Expected outcomes

  • A working toolchain on each learner's computer
  • Programs that compile cleanly with warnings enabled

Assessment

Practical: build and run a provided program, fix three compiler errors and one warning, then extend it with one calculation.

Free taster lesson C++ Fundamentals & Setup Read a free self-study lesson on this topic in the Free Course Library.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.