Computer Science Canada Procedure help |
Author: | shanestillwell [ Tue Jan 18, 2011 5:16 pm ] | ||
Post subject: | Procedure help | ||
What is it you are trying to achieve? i am creating a unit converter in turing and i have made a few procedures. What is the problem you are having?[/size my problem is with the if statements regarding the procedures, turing says that there are parameters missing in my call to my sub programs [size=14]Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) var amount: real var measurement1: string var measurement2: string var font1,font2,font3,font4:int font1:= Font.New("comicsans:25:bold") font2:= Font.New("elephant:20:bold") font3:= Font.New("algerian:30:bold") font4:= Font.New("arial:15:bold") View.Set("graphics") colourback(120) Text.Colour(50) locatexy(200,200) Font.Draw("WELCOME TO THE MEGA-VERTER",10,200,font3,25) delay(2000) cls Font.Draw("Use Abreviations Please",200,200,font1,43) delay(2000) cls Font.Draw ("From: ",10,310,font4,50) get measurement1 cls Font.Draw ("Amount: ",10,310,font4,50) get amount cls Font.Draw ("To: ",10,310,font4,50) get measurement2 cls %measurements procedure metric2imperial put measurement1,amount," is equal to: ",amount*.3937,measurement2 end metric2imperial procedure imperial2metric put measurement1,amount," is equal to: ",amount/.3937,measurement2 end imperial2metric procedure times_1(word :string)% mm to cm put measurement1,amount," is equal to: ",amount*0.1, measurement2 end times_1 procedure times_01(word :string)% mm to dm put measurement1,amount," is equal to: ",amount*.01,measurement2 end times_01 procedure times_001(word :string)%mm to m put measurement1,amount," is equal to: ",amount*.001,measurement2 end times_001 procedure times_0001(word :string)% mm to dkm put measurement1,amount," is equal to: ",amount*.0001,measurement2 end times_0001 procedure times_00001(word :string)% mm to km put measurement1,amount," is equal to: ",amount*.00001,measurement2 end times_00001 procedure times10(word :string)%cm to mm, dm to cm, m to cm, etc. put measurement1,amount," is equal to: ",amount*10,measurement2 end times10 procedure times100(word :string)% put measurement1,amount," is equal to: ",amount*100,measurement2 end times100 procedure times1000(word :string)% put measurement1,amount," is equal to: ",amount*1000,measurement2 end times1000 procedure times10000(word :string) put measurement1,amount," is equal to: ",amount*10000,measurement2 end times10000 %temperature procedure cel2far put measurement1,amount," is equal to: ",((amount-32)/9)*5,measurement2 end cel2far procedure far2cel put measurement1,amount," is equal to: ",((amount+32)*9)/5,measurement2 end far2cel %weight procedure ibs2kg put measurement1,amount," is equal to: ",amount*0.45359237, measurement2 end ibs2kg procedure kg2ibs put measurement1,amount," is equal to: ",amount/0.45359237, measurement2 end kg2ibs %shoe sizes procedure can2eur put measurement1,amount," is equal to: ",amount*6.91,measurement2 end can2eur procedure eur2can put measurement1,amount," is equal to: ",amount/6.91,measurement2 end eur2can procedure can2jap put measurement1,amount," is equal to: ",amount*4.28,measurement2 end can2jap procedure jap2can put measurement1,amount," is equal to: ",amount/4.28,measurement2 end jap2can procedure eur2jap put measurement1,amount," is equal to: ",amount/1.6125,measurement2 end eur2jap procedure jap2eur put measurement1,amount," is equal to: ",amount*1.6125,measurement2 end jap2eur procedure mensCAN2womens put measurement1,amount," is equal to: ",amount-2,measurement2 end mensCAN2womens procedure womensCAN2mens put measurement1,amount," is equal to: ",amount+2,measurement2 end womensCAN2mens %%%%%%%%%%%%%%%%%%%%% program starts %%%%%%%%%%%%%%%%% if measurement1="mm" and measurement2= "cm" then times_1 end if if measurement1="mm" and measurement2="dm" then times_01 end if if measurement1="mm" and measurement2="m" then times_001 end if if measurement1="mm" and measurement2="dkm" then times_0001 end if if measurement1="mm" and measurement2="km" then times_00001 end if if measurement1="cm" and measurement2="mm" then times10 end if if measurement1="cm" and measurement2="dm" then times_1 end if if measurement1="cm" and measurement2="m" then times_01 end if if measurement1="cm" and measurement2="dkm" then times_001 end if if measurement1="cm" and measurement2="km" then times_0001 end if if measurement1="dm" and measurement2="mm" then times100 end if if measurement1="dm" and measurement2="cm" then times10 end if if measurement1="dm" and measurement2="m" then times_1 end if if measurement1="dm" and measurement2="dkm" then times_01 end if if measurement1="dm" and measurement2="km" then times_001 end if if measurement1="m" and measurement2="mm" then times1000 end if if measurement1="m" and measurement2="cm" then times100 end if if measurement1="m" and measurement2="dm" then times10 end if if measurement1="m" and measurement2="dkm" then times_1 end if if measurement1="m" and measurement2="km" then times_01 end if %measurements
Please specify what version of Turing you are using <Answer Here> |
Author: | lordroba [ Tue Jan 18, 2011 5:48 pm ] | ||||
Post subject: | Re: Procedure help | ||||
You have parameters in your procedure. You don't need them there unless you're actually going to be doing something with the parameters. for example
when I call 'double' i need to include the parameter y because that's what it works on. You can either make modifications for your program to work with parameters or you can comment them out like I did here.
|
Author: | shanestillwell [ Tue Jan 18, 2011 5:56 pm ] |
Post subject: | RE:Procedure help |
thank you very much , im doing this for a school project and even my teacher couldnt tell me |