Computer Science Canada

car program

Author:  Jenkinz [ Sun May 07, 2006 8:02 pm ]
Post subject:  car program

i was fooling around with this for a while and got help from a friend, can someone please explain to me why i need the (count) in this?

code:
var car : array 1 .. 5 of string := init ("Hummer H2", "Ferrari Spyder", "Mini", "GTI", "Porsche GT2")
var price : array 1 .. 5 of int := init (80000, 150000, 30000, 35000, 250000)
var money : int
randint (money,80000, 250000)
put money
put "you can get these cars"
for count : 1 .. 5
    if price (count) <= money then
        delay (1000)
        put car (count)
    end if
end for


Author:  jamonathin [ Sun May 07, 2006 8:09 pm ]
Post subject: 

Maybe you should read up on arrays and for loops - Turing Walkthrough

The count runs through every car and every price that goes with that car.
If the price is right - it shows up.


: