Today’s little problem

So this got the heart racing today for some of you 🙂

Another subprogram in the building management software is used to find the range of temperatures in a building in one day. The temperature is recorded every 15 minutes within a 24 hour period and stored in a list.
Use pseudocode to design one algorithm to find both the highest and lowest temperatures in this list. (5Marks)

It was from the 2010 past paper, I asked you to code out the program. This program looks complicated but was a walk in the park for some people in the class, the rest of you need to go over the standard algorithms.

I gave you this snippet of code to create the data.

For counter = 1 To 96

temps(counter) = Int((Rnd() * 30) + 1)

Next

The solution looked like this (or something close)

min = temps(1)

Max = temps(1)

For Counter = 1 To 96

If temps(Counter) > Max Then Max = temps(Counter)

If temps(Counter) < min Then min = temps(Counter)

Next

MsgBox(“Max = ” & Max & ” Min = ” & min)

And the answer in the Marking Instruction looked like this, notice there is only 1 for loop, and correct indention can stop you losing marks on End IF (the Glow wordpress theme does not handle code snippets well, so no indentation)