Computer Science Canada

Having problems getting my arrays to work

Author:  _King_Of_All_ [ Wed Oct 09, 2019 6:43 pm ]
Post subject:  Having problems getting my arrays to work

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>

What is the problem you are having?
So for part of my program, I need to make an array. I have looked at the array tutorial page but I still can't understand where I am going wrong. The code also needs a way to find the average, above average and below average numbers. I have not yet made that for fear that I might screw this up even more.

Describe what you have tried to solve this problem
I have looked at the tutorial page and tried to add my own stuff to suit my needs.

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


var counter : int := 0

put "How many numbers would you like to enter?" ..
get counter

var countHighLow : array 1 .. counter of int

for i : 1 .. countHighLow
    put "Enter a number."
    get countHighLow(i) :*
end for

Please specify what version of Turing you are using
Latest version on this site

Author:  Clayton [ Tue Oct 15, 2019 4:40 pm ]
Post subject:  RE:Having problems getting my arrays to work

Look carefully at the start of your for loop:
for i : 1 .. countHighLow

Try to think of what
1 .. countHighLow
is actually saying, and carefully think of what countHighLow represents in this context.