Computer Science Canada

Help with round function

Author:  ovechking899 [ 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

Author:  Tony [ 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).

Author:  lordroba [ 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



: