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

Username:   Password: 
 RegisterRegister   
 Help with round function
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ovechking899




PostPosted: Mon Dec 21, 2015 1:02 pm   Post subject: Help with round function

What is it you are trying to achieve?
I want to round a number to 2 decimals

What is the problem you are having?
when i use the round function it gives error "Expression is not a procedure and hence cannot be called"

Turing:


money2 := money2 * 100
round (money2)
money2 := money2 / 100



Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Dec 21, 2015 4:16 pm   Post subject: RE:Help with round function

round is a function that returns a value, and not a procedure (that might or might not be modifying a value).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
lordroba




PostPosted: Wed Dec 23, 2015 1:22 am   Post subject: Re: Help with round function

Here's an example on how to use the function

Turing:


var money : real
var money2 : int
money := 10.55
money2 := round (money)
put money2

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: