Site Guide

Find your way around the Engineering Club.

Know what you need? Search for a component, concept or project.

Around the site

Start

Labs

TestingExperimental

Build

Club

LearnExperimental

Go a little deeper

Entry points to larger collections. Use Search for individual records.

Learning paths & reference

Inside PiCrawlerExperimental

Inside Inventory

Learn / C++ in practice

C++ Worked Programs

Learn C++ through complete programs, real outputs, and explanations of how the code works.

Choose any example. These desktop C++17 programs run in a terminal on your computer. The collection includes worked programs, a refactoring slice, a debugging autopsy, and a clearly labeled architecture study.

17 of 17 entries

BeginnerWorked program

Visible Spectrum Classifier

Make threshold logic physically meaningful

Console streams and complete-line input/output · Finite double arithmetic, precision and round-off · Branch order, validated domains and early returns

Physics · Classification · UnitsStudy this program →
BeginnerWorked program

Temperature Converter

Units, return objects and a physical boundary

Console streams and complete-line input/output · Finite double arithmetic, precision and round-off · Parameters, cohesive calculation functions and return values

Units · ThermodynamicsStudy this program →
BeginnerWorked program

Circle Geometry Table

Finite loops on a floating-point grid

Console streams and complete-line input/output · Finite double arithmetic, precision and round-off · Finite iteration domains and termination conditions

Geometry · Numerical computation · TablesStudy this program →
IntermediateWorked program

Triangle Analyzer

Domain checks before geometry

Fixed-size collections, initialized elements and indexed access · Named value records and grouped state · Aliases for mutable or read-only existing objects

Geometry · Trigonometry · Data modelingStudy this program →
BeginnerWorked program

Prime Finder

Prove a loop boundary, then reduce the work

Integer domains, truncation and arithmetic limits · Branch order, validated domains and early returns · Finite iteration domains and termination conditions

Algorithms · Number theoryStudy this program →
BeginnerWorked program

Nested Loop Pattern Generator

Turn row geometry into precise loop bounds

Integer domains, truncation and arithmetic limits · Finite iteration domains and termination conditions · Dependent and independent iteration bounds

Loops · PatternsStudy this program →
BeginnerWorked program

Two-Resistor Network Calculator

Keep electrical topology separate from input and display

Finite double arithmetic, precision and round-off · Parameters, cohesive calculation functions and return values · Named value records and grouped state

Electronics · CircuitsStudy this program →
IntermediateWorked program

RC Capacitor Charging

Map a first-order physical model to a finite table

Finite double arithmetic, precision and round-off · Parameters, cohesive calculation functions and return values · Value parameters, caller inputs and calculation contracts

Electronics · Differential equations · Exponential responseStudy this program →
IntermediateWorked program

Wood Movement Teaching Model

Lookup tables need unit semantics and evidence labels

Fixed-size collections, initialized elements and indexed access · Named value records and grouped state · Aliases for mutable or read-only existing objects

Materials · Lookup tables · Dimensional changeStudy this program →
BeginnerWorked program

Linear Thermal Expansion Table

A threshold marker is an explicit policy

Finite double arithmetic, precision and round-off · Parameters, cohesive calculation functions and return values · Finite iteration domains and termination conditions

Materials · Thermal expansion · TablesStudy this program →
IntermediateWorked program

Ideal Projectile Motion Table

Functions return a related set of physical predictions

Parameters, cohesive calculation functions and return values · Named value records and grouped state · Finite double arithmetic, precision and round-off

Mechanics · Trigonometry · Simulation modelsStudy this program →
BeginnerWorked program

Piecewise Function Table

Equality can be correct when the domain is deliberate

Parameters, cohesive calculation functions and return values · Value parameters, caller inputs and calculation contracts · Finite double arithmetic, precision and round-off

Functions · Piecewise math · Numerical domainsStudy this program →
IntermediateWorked program

Rock Paper Scissors

Explicit moves, invalid input and testable state

Owned strings, byte normalization and complete lines · Scoped finite value domains · Parse success or failure as distinct states

Games · State · RandomnessStudy this program →
IntermediateWorked program

Measurement File Analyzer

A new class example with a real invariant

Objects with interfaces and protected invariants · Automatic lifetime, construction and resource destruction · Dynamic collections with size, capacity and ownership

Data · Files · ClassesStudy this program →
IntermediateRefactoring case study

Functionator: Extracting a State Model

A runnable refactoring slice of a 1,017-line RPG

Named value records and grouped state · Aliases for mutable or read-only existing objects · Scoped finite value domains

Refactoring · State · ArchitectureStudy this case →
BeginnerDebugging autopsy

Bounds Autopsy: Size Is the Contract

From a confirmed heap overflow to checked access

Dynamic collections with size, capacity and ownership · Fixed-size collections, initialized elements and indexed access · Zero-based indices and checked access

Debugging · Memory · ContainersStudy this case →
AdvancedArchitecture case study

Nebula Lance: Real-Time Project Anatomy

A blocked graphical build with instructive state and collision structure

Dynamic collections with size, capacity and ownership · Named value records and grouped state · Aliases for mutable or read-only existing objects

Graphics · External libraries · Real timeStudy this case →

Build and run on your computer

These programs run on your computer in a terminal. VS Code edits the text; a compiler translates it and links an executable; the terminal launches that executable and supplies input. Installing the editor or a C++ extension alone does not install a compiler. No Arduino board or upload step is needed for this collection.

Windows with GCC

Follow the current official VS Code Windows/GCC setup guide at https://code.visualstudio.com/docs/cpp/config-mingw to install/configure a toolchain. Open a fresh terminal afterward and check that g++ --version resolves. The observed builds in this audit used Linux GCC 13.3.0; the Windows commands below are practical GCC guidance, not a claim that Windows was tested here.

Open one program folder, for example programs/rc-charging, then run:

powershell
g++ -std=c++17 -Wall -Wextra -Wpedantic main.cpp -o program.exe
.\program.exe

Enter the prompted values on separate lines. If compilation fails, resolve the diagnostic before attempting to run an older executable. For the Functionator slice, supply both translation units:

powershell
g++ -std=c++17 -Wall -Wextra -Wpedantic main.cpp game.cpp -o program.exe
.\program.exe

The header describes declarations and shared types; it is not a separate executable. measurement-log takes a file argument: .\program.exe sample-measurements.txt. RPS supports .\program.exe --demo for reproducible opponent choices. Each README shows the exact input and captured output for its own source.

Linux or another configured GCC terminal

Use the same compile arguments and -o program, then run ./program. Compiler and executable filenames, terminal syntax and installed library support differ by platform. C++17 standard-library mechanisms are the portability target; these audits do not establish all-platform behavior.

Verification tools

Python 3.10+ runs the package validator without third-party dependencies. The build verification script locates g++ and creates fresh binaries in temporary folders. Its sanitizer mode uses GCC/Linux flags and disables LeakSanitizer under runtime tracing. GCC's instrumentation reference is https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html. Do not infer that the same flags are supported by every Windows compiler.

Nebula is not built by these instructions. It requires a real Raylib installation, API repair, linked build and graphical/audio verification. Its .cpp.txt anatomy excerpt is explanatory evidence. The standalone collision reproduction tests only an isolated transition, and should not be substituted for the game.