You are looking at: Practice test 1. Your place is still lesson 10, task 1: struct.
test/1/rising.c: the longest stretch where each number is greater than the one before; of several the same length, the first wins.
Checklist
The file test/1/rising.c, the program test1_rising.
The program asks how many numbers (1 to 30), reads them into an array and finds the longest rising run: neighbouring numbers where each is greater than the one before.
How many numbers? 8
1. Number: 5
2. Number: 1
3. Number: 3
4. Number: 4
5. Number: 2
6. Number: 6
7. Number: 7
8. Number: 8
Longest rising run: 2 6 7 8
Length: 4, starts at place 5
The runs here are 5, 1 3 4 and 2 6 7 8. The longest is the last one, and it starts at place 5 (places are numbered from 1).
3 3 is two separate runs of one number each.There must be 1 to 30 numbers.First write a function that says how many numbers rise from place from: it starts at 1 and grows while the next number is greater than the one before and the array hasn't ended. Then a second function goes over every start and remembers the best one: the same search as warmest in topic 6, only comparing lengths. Both with contracts and assert.
Mind the bounds: when you check a[i + 1], i + 1 must be less than n.
The first test is the example above. The second is an invalid count, 31, then 9 7 3 5 1 4: two runs of two numbers (3 5 and 1 4), and the first one wins:
Longest rising run: 3 5
Length: 2, starts at place 3
When ctest --preset debug -L test1 shows 100% tests passed, commit: Solve test 1: longest rising run.
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.