Skip to the task
Layout
Back to classic view

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

RUNTask 5 of 28 · step 3: A week of temperaturesRun it with a week of temperatures
Run it with a week of temperatures in practice/06/

File → Reload CMake Project, pick p06_temperatures and ▶. Type 3, -2, 5, 8, -1, 4, 6.

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\06\p06_temperatures.exe
1. Temperature: 3
2. Temperature: -2
3. Temperature: 5
4. Temperature: 8
5. Temperature: -1
6. Temperature: 4
7. Temperature: 6
Temperatures: 3 -2 5 8 -1 4 6
Average: 3.29

You should see: All seven values on one line and the average 3.29 (23 / 7).

practice 06 CMakeLists.txt Code Diff +2
A · NEW FILE Create this file. Every line is new: see the green bar.
add_executable(p06_temperatures main.c)
target_link_libraries(p06_temperatures PRIVATE course_input)
opened for this task
$ .\build\debug\practice\06\p06_temperatures.exe
1. Temperature: 3
2. Temperature: -2
3. Temperature: 5
4. Temperature: 8
5. Temperature: -1
6. Temperature: 4
7. Temperature: 6
Temperatures: 3 -2 5 8 -1 4 6
Average: 3.29