C++
Learn modern C++ by extending the concrete C model you already built. Each chapter adds one ownership, lifetime, generic, resource, or concurrency idea, produces exact evidence, and states which stronger system claim remains unproved.
Your first C++20 program: source, compiler, value, and output
Objective Reuse the completed C terminal model to compile one C++20 source file and verify its exact value, output, and exit status.
Core explanation
A C++ source file is still plain text, but this course compiles .cpp files with the C++ driver and an explicit C++20 mode. The driver named c++ selects the C++ language rules and links the matching standard library. Starting the resulting executable creates a process whose output and exit status can be observed exactly. The first program introduces only four new surface details. iostream declares the stream objects, std names the standard-library namespace, cout is the standard output stream, and the insertion operator sends the fixed text to that stream. A static assertion makes the selected language revision a compile-time requirement. This run proves one compiler, one source file, one output line, and status zero; it does not yet prove multiple-file linkage, classes, RAII, templates, concurrency, ABI stability, or production readiness.
Reuse the C evidence loop with the C++ driver
The completed C course already separated source text, compiler command, executable file, running process, standard output, and exit status. C++ keeps those objects but changes the source suffix to .cpp, uses the C++ driver named c++, selects -std=c++20, and links the matching C++ standard library. Chapter 1 changes only that language boundary rather than reteaching the complete native toolchain.
Run c++ --version before compiling and preserve the identifying line. If the command is unavailable or rejects -std=c++20, stop and use the setup guide instead of reporting the shown result. The baseline proves only the recorded implementation, one file, one strict command, one executable, exact output, and status zero. It does not prove another compiler, standard library, platform, build system, or packaged artifact.
Read the first program without opening every later abstraction
#include <iostream> makes the standard stream declarations available. std is the standard-library namespace and cout is its ordinary output stream. The insertion operator sends each value from left to right into that stream. int completed{1} creates one initialized integer; Chapter 2 explains brace initialization and conversions in full.
static_assert checks the language revision while compiling, so a driver that does not establish at least the C++20 language value produces no new baseline executable. main returns zero after writing one newline-terminated record. Classes, references, constructors, destructors, templates, exceptions, RAII, threads, and ABI details do not need to be mastered to explain this first result; they receive their own chapters.
Compile, run, and compare two exact evidence lines
Save the copied source as hello.cpp in an owned disposable folder. Compile with c++ -std=c++20 -Wall -Wextra -Wpedantic -Werror hello.cpp -o hello-cpp. Every token has one immediate role: driver, language revision, diagnostic policy, source, and executable name. Do not continue to ./hello-cpp when the compiler returns nonzero because an older executable can remain in the folder.
Run ./hello-cpp and then inspect the immediately preceding status using the setup guide. The contractual output is language=C++ standard=C++20 completed=1 followed by exit=0 from the terminal. Record standard output separately from any compiler diagnostic. Multiple translation units, the One Definition Rule, libraries, symbols, CMake, ABI compatibility, and runtime loading are deferred until the learner has values and ownership to place across those boundaries.
Laboratory: change one value and recover from stale output
Predict the output with completed=2, change only the initializer, save, rebuild with the identical command, run, and compare. Next remove one semicolon, predict that compilation returns nonzero, and do not run the preexisting executable as evidence for that failed source. Preserve the diagnostic, restore the semicolon and completed{1}, rebuild, and recover the exact baseline.
Acceptance requires the recorded compiler identity, complete command, source filename, compile status, executable name, output, process status, one-value mutation, one syntax failure, and restored baseline. No IDE, debugger, package manager, CMake, administrator access, network, cloud, or production system is required. A second learner should be able to reproduce the loop from the saved file and notes without guessing which artifact ran.