
-----------------------------------
Zeppelin
Fri May 23, 2008 8:15 pm

Help with Rounding
-----------------------------------
For some reason I can't round numbers. I looked in the Turing help file and it seems I'm doing it correctly but I constantly get an error that reads "b is not a procedure and hence cannot be called" I tried the same thing with a number like 1.5 and got the same error. Judging by this code could you tell me what I'm doing wrong (Note it's not done yet so there are a bunch of unused veriables and unfinished code)?


var Angle, Angle2, CoAx, Line, XBullet, YBullet : int
var c, b : real


CoAx := 25

%Angle := Rand.Int (0, 89)
Angle := 60
%Line := Rand.Int (1, CoAx)
Line := 12

if Angle < 90 then
b := Line * cosd (Angle)
c := Line * cosd (90 - Angle)

round (b)
round (c)
end if

%elsif Angle >= 90 and < 180 then
%Angle2 := Angle - 90

put b
put c


-----------------------------------
gitoxa
Fri May 23, 2008 8:18 pm

RE:Help with Rounding
-----------------------------------
round, ceil, and floor are functions.  Functions return a value.  Typing in

round (b)

is the same as typing in

12

You have to use the value in some way.  Either by assigning it, using it in a decision structure, or even using it in another function.

-----------------------------------
Zeppelin
Fri May 23, 2008 9:12 pm

Re: Help with Rounding
-----------------------------------
Thanks for the help. The program works now.
