Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Having problems getting my arrays to work
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
_King_Of_All_




PostPosted: 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)


Turing:


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
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: 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:
Turing:
for i : 1 .. countHighLow


Try to think of what
Turing:
1 .. countHighLow
is actually saying, and carefully think of what countHighLow represents in this context.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: