Skip to the task
Layout
Back to classic view

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

RUNTask 5 of 17 · step 3: The City structureRun p10_cities
Run p10_cities in practice/06/

File → Reload CMake Project, pick p10_cities and ▶.

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.
  • A multi-file program: .h files with Doxygen comments and their own CMake target.
  • Input only through the safe functions of your own input.h.
Details & hint
$ .\build\debug\practice\10\p10_cities.exe
Kaunas: 300000 people, 157.0 km2
Vilnius: 600000 people, 401.0 km2
sizeof(City): 32
kaunas: 300000, copy: 0
After grow_copy: 300000
After grow:      301000

You should see: Changing the copy leaves the original alone; grow_copy changes nothing, grow adds 1000.

practice 06 CMakeLists.txt Code Diff
UNCHANGED This step does not change this file.
add_executable(p06_temperatures main.c)
target_link_libraries(p06_temperatures PRIVATE course_input)
add_executable(p06_search search.c)
add_executable(p06_hall hall.c)
opened for this task
$ .\build\debug\practice\10\p10_cities.exe
Kaunas: 300000 people, 157.0 km2
Vilnius: 600000 people, 401.0 km2
sizeof(City): 32
kaunas: 300000, copy: 0
After grow_copy: 300000
After grow:      301000