On 10/10/16, dream master said the following...
im trying to get a percentage to display correctly. this is the math
va
percent : real;
begin
percent := 1 / 248 * 100;
writeln(real2str(percent,2));
end
how can i get the decimal to show in the proper place or is there somethin new?
i tried write(percent:62); but thats not supported in mpl. any ideas?
Here's what I uses in my Greed game to show the percentage of the play field that got ate.
Function Score2Str(Sc:LongInt):String
Var F,B : Integer
Var Score : LongInt
Begin
Score:=(sc*100)/(COLS*ROWS)*100
F:=Score/100
B:=Score-(F*100)
Score2Str:=Int2Str(F)+'.'+PadLt(Int2Str(B),2,'0')
End
"No matter where you go, there you are!" - Buckaroo Bonzai
--- Mystic BBS v1.12 A31 (Raspberry Pi)
* Origin: Cyberia BBS | Cyberia.Darktech.Org | Kingwood, TX (21:1/120)