Skip to main content

Validated Parsing

Challenge on lesson: Checkpoint: Robustness

Implement parse_percent(text) returning the percentage as a double in [0, 100]: throw std::invalid_argument for non-numeric text, std::out_of_range for numbers outside the range. Valid values return normally.

Difficulty: beginner

Back to lesson: Checkpoint: Robustness