Coder's Guild Mailing List

Re: Turbo Pascal 7 - Divide by 0 question

Posted by Wong Hoi Ko on 1999-05-12

> > 2) How do I get it to round the result off to 2 places? (from
> > .352174....... to .35)
> look at STR procedure in help.


  May be you can use this method:
  multiply your number to 100
 and then use round 
 and then divde it back by 100

 e.g.
 var a:real;
 begin
   a:=55.55

   a:=round(a*100) /100
 end.

+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-
>From Wong Hoi Ko, autokim@xxxxxx.xxx,
WebMaster of Autosoft http://members.xoom.com/autokim 
WebMaster of SMSR http://members.tripod.com/~autokim
Worker on PTSS 6A Homepage http://extend.hk.hi.cn/~ptss6a
+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+-*/+