Unit 01 — Example Programs

← Unit 01 index · ← Course home

Three small programs accompany the Unit 01 sessions. Each is annotated line by line — read the comments, then compile and run.

File Session The lesson inside
01_hello.cpp Session 1.1 The smallest complete program: include, main, one output statement
02_anatomy.cpp Session 1.2 The same program annotated piece by piece — what each line is
03_output_basics.cpp Session 1.2 cout chaining, endl vs \n, escapes, and the predict-then-run loop

Compile any of them with the course’s standard command:

g++ -std=c++17 -Wall -Wextra 01_hello.cpp -o hello
./hello

These examples are the Unit 01 teaching set; the complete maintained Foundations module builds directly on them.