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

Username:   Password: 
 RegisterRegister   
 car program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jenkinz




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

Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Sun May 07, 2006 8:09 pm   Post subject: (No 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.
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: