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

Username:   Password: 
 RegisterRegister   
 Help With Currency Program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Cloudx99




PostPosted: Tue May 26, 2009 10:26 am   Post subject: Help With Currency Program

What is it you are trying to achieve?
I'm trying to make a program that converts currency.


What is the problem you are having?
I'm having problems with the if statements


Describe what you have tried to solve this problem
I've tried what I can do.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


%The "Currency" Program
var name : string
var answer,answer1: string
var CAD,USD,EUR,AUD,Total,Money: real

put "Hello, please enter your name"
get name:*
put "Hello " ..
put name ..
put ", Choose the Currency your converting from"
put "American [USD]"
put "European [EUR]"
put "Australian [AUS]"
get answer
put "Enter the amount of ", answer
get Money


if answer=USD
    Total := Money * 1.1235
    put Total
elsif answer=EUR
    Total := Money * 1.5693
    put Total
elsif answer=AUS
    Total := Money * 0.8771
    put Total
end if



Please specify what version of Turing you are using
4.0.3
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Tue May 26, 2009 10:31 am   Post subject: RE:Help With Currency Program

You're mostly right, but you want to put double-quotes (these things: " " ) around USD, EUR and AUS in your if statements. That lets Turing know that they're strings and that you mean to compare the value in your answer variable to the string values "USD", "EUR" and "AUS".
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: