Help with Rounding
Author |
Message |
Zeppelin
![](http://compsci.ca/v3/uploads/user_avatars/9053317224742204e85b5a.gif)
|
Posted: Fri May 23, 2008 8:15 pm Post subject: 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)?
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
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
gitoxa
![](http://compsci.ca/v3/uploads/user_avatars/125344263047f801d546bcb.jpg)
|
Posted: Fri May 23, 2008 8:18 pm Post subject: RE:Help with Rounding |
|
|
round, ceil, and floor are functions. Functions return a value. Typing in
is the same as typing in
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. |
|
|
|
|
![](images/spacer.gif) |
Zeppelin
![](http://compsci.ca/v3/uploads/user_avatars/9053317224742204e85b5a.gif)
|
Posted: Fri May 23, 2008 9:12 pm Post subject: Re: Help with Rounding |
|
|
Thanks for the help. The program works now. |
|
|
|
|
![](images/spacer.gif) |
|
|