Integers, signs, and overflow

F-INT-V4-3hard

Clamp coin edits

A save editor for a retro game stores each stage’s coin count in one byte.

What needs to change

Repair adjust so each edit changes one stage’s count and the count stays within 0 to 255.

Reproduce

  1. Compile and run the sample edit with g++, then use Check work for the remaining edits; some are large.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its headers, the Change struct, readEdit, checksum and main. The browser compiles with g++ -std=c++23.

Input: the first line holds the slot’s counts; each later line is a 1-based stage and an int delta. main passes adjust a 0-based index.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in