Bits, bytes, and binary

F-BITS-V4-2medium

Read only hex digits

A colour tool writes and reads #rrggbb codes for a style sheet.

What needs to change

Repair channelFrom so a code is accepted only when every field after the # is two hex digits.

Reproduce

  1. Compile and run the three-code sample with g++, then compare every line and verdict with the expected stdout.

Acceptance criteria

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

Notes

The file contains its headers, the Colour struct, readCodes, hexByte, parseColour and main. The browser compiles with g++ -std=c++23.

Input: one code per line; readCodes keeps the first word. parseColour checks the # and the size and passes channelFrom each two-character field.

Sign in to open this exercise

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

Sign in