Bits, bytes, and binary

F-BITS-V4-3hard

Expand short codes

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

What needs to change

Repair shortChannel so a three-digit #rgb code prints the colour it names.

Reproduce

  1. Compile and run the sample with g++, then use Check work for the remaining codes; several are #rgb codes.

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, channelFrom, colourOf, parseColour and main. The browser compiles with g++ -std=c++23.

Input: one code per line, #rgb or #rrggbb. readCodes keeps the first word of each line. For a #rgb code, parseColour passes shortChannel one char at a time.

Sign in to open this exercise

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

Sign in