Guided lessons
Ordered steps with prerequisites, worked examples, exercises, and checks. Small steps, no gaps.
// cp4cpp · learn by compiling
CP4CPP teaches C++ and the algorithms behind competitive programming: guided lessons, a proof-first wiki, and tools that turn theory into reflexes.
#include <iostream> int main() { std::cout << "Hello, CP4CPP!\n"; return 0;}This is Lesson 01: your entire first session takes one screen.
§ 01 · choose a route
§ 02 · how it teaches
Ordered steps with prerequisites, worked examples, exercises, and checks. Small steps, no gaps.
Every algorithm comes with its statement, a proof you can follow, and an implementation you can trust.
Simulations of states, graphs, and geometry. Watch the algorithm move instead of imagining it.
§ 03 · straight from the wiki
The wiki is being written around the bit tricks competitive programmers use. Planned entries will connect each statement to a proof and implementation.
// x ^ x == 0 x ^ 0 == x order does not matterconstexpr bool is_power_of_two(unsigned mask) { return (mask & (mask - 1)) == 0; // ① power of two test: true only here} constexpr unsigned low_bit(unsigned mask) { return mask & (-mask); // ② isolate lowest set bit}§ 04 · the whole system
§ 05 · the quality contract