I dont know what i'm doing wrong, help!
Author |
Message |
tempname90000000
|
Posted: Wed Oct 29, 2014 9:17 am Post subject: I dont know what i'm doing wrong, help! |
|
|
What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
What is the problem you are having?
<program to input the length in a chosen unit and output the conversion in a chosen unit, i dont know how to let them choose which unit to use>
Describe what you have tried to solve this problem
<how do i put, "if cm use this formula, or if inches, use this formula">
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
<var cms,incs,A,ft:real
var cms1,incs1,A1,ft1:boolean
var cmsEQincs,cmsEQft,incsEQcms,incsEQft,ftEQcms,ftEQincs:real
var amt:real
put "Enter your desired unit:cms for centimeters, incs for inches and ft for feet"
get cms1
put "Enter the amount"
get amt
cmsEQincs:=incs/2.54
%Inches into Centimeters
cmsEQft:=30.48*ft
%Feet into centimeters
incsEQcms:=0.393701*cms
incsEQft:=ft*12
%Feet into inches
ftEQcms:=0.0328084*cms
%Centimets into feet
ftEQincs:=0.0833333*incs
%inches into feet
>
|
Please specify what version of Turing you are using
<4.1.2>
r |
|
|
|
|
|
Sponsor Sponsor
|
|
|
tempname90000000
|
Posted: Wed Oct 29, 2014 9:19 am Post subject: RE:I dont know what i\'m doing wrong, help! |
|
|
Btw some of these codes are just me testing random stuff out, like the boolean |
|
|
|
|
|
Tony
|
Posted: Wed Oct 29, 2014 1:58 pm Post subject: Re: I dont know what i'm doing wrong, help! |
|
|
tempname90000000 @ Wed Oct 29, 2014 9:17 am wrote: if cm use this formula
that's almost it.
code: |
var units : string
put "what units?"
get units
if units = "cm" then
put "you've chosen cm"
end if
|
There are more details tutorials on if statements available via Turing Walkthrough page. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|