You are looking at lesson 4. Your place is still Practice test 1, task 1: About.
hw/04/main.c: a colleague's program with three bugs. Find them with the debugger, fix them, tidy the code and write up DEBUGGING.md.
Checklist
This time you don't write from scratch. The folder hw/04 holds a colleague's program that compiles but calculates wrongly.
hw/04/main.cThe program asks how many grades there will be, reads them and prints the average, the lowest grade and whether the student gets a scholarship: an average of 8.5 or more and no grade below 6.
How many grades? 4
Grade: 9
Grade: 8
Grade: 10
Grade: 8
Average: 8.75
Lowest: 8
Scholarship: yes
There are three bugs in the code. Your job:
{ }, the #include order as in the other topics.hw/04/DEBUGGING.md: for each bug, the line, what the debugger showed and how you fixed it.Each of these in its own commit. The lecturer will see in the history how you searched.
Two output tests and one file test: DEBUGGING.md has all three sections and no TODO left.
ctest --preset debug -L hw04
With the program unfixed, the first test ends like this:
=== hw04_scholarship_1: FAILED ===
The program ended with code 1 (must be 0).
The output differs on line 6.
expected: |Average: 8.75|
got: |Grade:~|
(\t = tab, ~ = a space at the end of the line)
--- error output (stderr) ---
The input ended.
That is already a first hint: after four grades the program asks for a fifth, and the input has already ended.
The tests don't check style: the lecturer grades the code, the names and what DEBUGGING.md says.
Commit and push. Actions → Points: HW 4 (Scholarship), 10 points when all three tests pass.
Each one ticks itself when you do it.
All six done. You know your way around.
It is laid out like CLion: the same panels in the same places. This tour shows each one, and you can reopen it any time with Tour.
Switches the left panel: Lesson plan, Project files, Changes. Click the active icon again to hide the panel.
In CLion: the tool window bar runs down the left edge, too.
This part is not on this task: it appears when a task needs it.
Every task in this lesson. Now marks your place. Clicking a task only lets you look; it never moves your place. Project files and Changes open here too.
In CLion: this spot holds the Project view (the file tree).
This part is not on this task: it appears when a task needs it.
Opens the file for your task by itself. A tab appears for each file the step opens. The breadcrumbs above the code show the folder.
In CLion: the same editor tabs and breadcrumbs.
This part is not on this task: it appears when a task needs it.
Diff shows what changed, like git diff: red is the old code, green the new.
In CLion: the diff view in the Commit window looks the same.
This part is not on this task: it appears when a task needs it.
Terminal for build commands, Database to see your tables. They open by themselves when a task needs them. Drag the top edge to resize.
In CLion: Terminal, and the Database tool window.
This part is not on this task: it appears when a task needs it.
What to do now, right above the code, so you never miss it. Numbered notes in the code explain the important lines. Details shows what you should see and a hint.
In CLion: no equivalent: this is your lecturer's guide.
This part is not on this task: it appears when a task needs it.
Done is the only button that moves you forward. Look back lets you review without losing your place.
This part is not on this task: it appears when a task needs it.
Guided, Focus code or Floating. You can drag the panel edges too. Your layout is remembered for next time.
In CLion: you can also rearrange and hide tool windows.
This part is not on this task: it appears when a task needs it.
Six small missions. Each one ticks itself when you do it, so you know you have found everything.