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

Username:   Password: 
 RegisterRegister   
 I dont know what i'm doing wrong, help!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tempname90000000




PostPosted: 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
Sponsor
sponsor
tempname90000000




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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: