
-----------------------------------
Chimaera
Sun Feb 08, 2004 2:57 pm

Getting the last kink out of my program about running arrays
-----------------------------------
My program should run but doesn't run on account of an error that I cannot assign a subscript to arrays >.> I don't get why it doesn't work and also the other 2 errors are due to the same array issue. It says missing time compression value. Please help me thanks!

var num : int
var distance : int
var clubdist : int

get distance
get num
var arrayofclubs : 1 .. num of int
for i : 1 .. num
    get arrayofclubs(i)
end for
for i : 1 .. num
    clubdist := clubdist + arrayofclubs(i)
end for
if clubdist = distance then
    put "Roberta wins in ", num
else
    put "Roberta acknowledges defeat"
end if


-----------------------------------
Paul
Sun Feb 08, 2004 3:09 pm


-----------------------------------
Um thats not how you do an array, isn't it:

var arrayofclubs : array 1 .. num of int 

oh yea

var clubdist : int :=0

or whatever, or else it has no value. and can't be used in:

    clubdist := clubdist + arrayofclubs(i) 


-----------------------------------
Chimaera
Sun Feb 08, 2004 3:35 pm


-----------------------------------
Thanks for your help. It works now! yay
