Skip to the task
Layout
Back to classic view

You are looking ahead. Your place is still task 1: Functions.

RUNTask 7 of 23 · step 4: Contracts and testsRun it with the same input
Run it with the same input in practice/04/

3, 9, 11, 4, 10.

Checklist

  • Every task is one commit with a clear message.
  • Zero compiler warnings: the code builds with -Werror.
  • Once per topic you step through your code in the debugger (CLion, gdb).
  • Every function has preconditions and postconditions, and assert tests check them.
Details & hint
$ .\build\debug\practice\05\p05_grades.exe
How many grades? 3
1. Grade: 9
Very good
2. Grade: 11
Grade must be between 1 and 10.
Grade: 4
Unsatisfactory
3. Grade: 10
Excellent
Average: 7.67
Rounded: 8

You should see: The tests pass silently, the program works as before, and at the end: Rounded: 8.

practice 04 CMakeLists.txt Code Diff
UNCHANGED This step does not change this file.
add_executable(p04_average main.c)
target_link_libraries(p04_average PRIVATE course_input)
opened for this task
$ .\build\debug\practice\05\p05_grades.exe
How many grades? 3
1. Grade: 9
Very good
2. Grade: 11
Grade must be between 1 and 10.
Grade: 4
Unsatisfactory
3. Grade: 10
Excellent
Average: 7.67
Rounded: 8