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

Username:   Password: 
 RegisterRegister   
 Syntax Error at 'Integer Literal'
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lucklesslily




PostPosted: Fri Nov 06, 2015 10:20 am   Post subject: Syntax Error at 'Integer Literal'

I'm trying to create a procedure that will convert Fahrenheit to Celsius and vice versa, but I'm running into some problems and I'm very confused.

procedure conversion
if tempType = "c"
then 5/9*('f'-32) %Turing says that there's a Syntax Error at 'Integer Literal' with this, and idk what else to do?
elsif
tempType = "f"
then 9/5*('c'+32) %The same with the 9
end if
end conversion


Embarassed Exclamation Question Embarassed
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Nov 06, 2015 12:22 pm   Post subject: RE:Syntax Error at \'Integer Literal\'

You aren't doing anything with the result of the equation. If you don't do something with it, then it just ceases to exist after the equation is done. Turing knows this makes no sense, so it gives you an error. You need to either output the result of that equation or save it to a variable.

By the way, what are 'f' and 'c'? if you try to multiply those by a number, Turing will either throw another error or substitute the ASCII code for that character into the equation (I'm not sure which). I really don't think that's what you intended. Maybe you meant those to be variables?
lucklesslily




PostPosted: Sat Nov 07, 2015 4:10 pm   Post subject: Re: Syntax Error at 'Integer Literal'

F and C stand for Fahrenheit and Celsius, I've fixed the integer literal error, assigning it to the variable finalTemp. But as you said, I'm now running into a problem with the ('c'+32) thing.
Insectoid




PostPosted: Sat Nov 07, 2015 8:49 pm   Post subject: RE:Syntax Error at \'Integer Literal\'

What is celsius + 32? That doesn't make any sense. That's like asking what's dog * apple. You just can't do it. Because 'c' is just a letter. You can't just add letters to numbers, it doesn't make any sense.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: