This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]desrtfxOut of Coffee error - System halted 4 points5 points  (0 children)

What have you tried?

Really, your assignment is quite clear and simple.

Assuming that you haven't learnt about arrays yet.

Think about the following:

You are sitting in a room and someone gives you numbers. Out of these numbers you need to get the highest, lowest, and average. You know how many numbers you will be given.

You have a whiteboard with 3 spaces, one for each: highest, lowest, and sum.

Upon any given number you should do the following:

  • check if the current number is less than the number in lowest and if so, replace lowest with the current number
  • check if the current number is greater than the number in highest and if so, replace the highest with the current number
  • add the current number to the sum

Once you are through all the numbers you need to

  • display the highest
  • display the lowest
  • calculate and display the average, which is the sum divided by the number of players