H haisongzhang Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-23 #1 定义两个浮点形变量: m,n:double 怎样把他们的积显示到一个Edit中,并且只保留小数点后两位? 谢谢
D dopro Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-23 #2 edit1.txt:=floattostr(trunc((m*n)*100)/100)
春 春意 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-23 #3 procedure TForm1.Button1Click(Sender: TObject); var a,b:double; c:integer; s:string; begin a:=2.22; b:=3.33; c:=trunc(a*b*10); s:=inttostr(c); edit1.text:=copy(s,1,length(s))+'.'+copy(s,length(s)-1,1); end;
procedure TForm1.Button1Click(Sender: TObject); var a,b:double; c:integer; s:string; begin a:=2.22; b:=3.33; c:=trunc(a*b*10); s:=inttostr(c); edit1.text:=copy(s,1,length(s))+'.'+copy(s,length(s)-1,1); end;
T thinknet Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-23 #4 edit1.text:=formatfloat('0.00',m*n);