Absence, zero, and empty values

F-ABSENCE-V4-3hard

Average the answers

A coffee survey records cups per day, where 0 is a real answer and a blank means the question was skipped.

What needs to change

Repair averageText so each question’s average uses only the answers that were given.

Reproduce

  1. Compile and run the question sample with g++, then use Check work for questions with blank answers.

Acceptance criteria

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

Notes

The file contains its headers, readLines, cut, parseAnswer and main. The browser compiles with g++ -std=c++23.

Input: one question per line, its name, a space and comma-separated answers; a blank answer is an empty field.

Pilot input: each question has one to five comma-separated fields; a field is blank or a whole count from 0 to 20. Question names are single tokens followed by one space, with no spaces inside the answer list. The reader receives valid syntax and does not validate these bounds.

Sign in to open this exercise

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

Sign in