Skip to the task
Layout
Back to classic view

You are looking at: Practice test 1. Your place is still lesson 7, task 1: Modules.

CHECKTask 11 of 17 · step 3: Questions 7–12

assert and input

What is wrong?

int age = read_int("Age: ");
assert(age >= 0);
Stuck?

assert checks the programmer's mistakes, not input: in Release (NDEBUG) it disappears. Check input with a while loop. (Topic 5)