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

Username:   Password: 
 RegisterRegister   
 HELP!!!!! Need help with making a certain turing program
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DanShadow




PostPosted: Tue Jan 13, 2004 9:03 am   Post subject: (No subject)

Maybe you could just do it easy...put it in a for loop.
code:

var km,gas:int:=0
gas:=200
for i:1..distance_to_location_in_kilometres
if km=100 then
gas:=gas-50
km:=0
end if
km:=km+1
end for

This goes through a for loop 1.. the length of the trip.A variable adds each kilometre it goes. When it hits 100 kilometres, the car loses 50 gas. This can be changed..it can lose like 1 gas every kilometre...but im not sure how much gas you want it to take per kilometre...so just edit that.
Sponsor
Sponsor
Sponsor
sponsor
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 2 of 2  [ 16 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: