W wanglong0 Unregistered / Unconfirmed GUEST, unregistred user! 2008-10-05 #1 如何把cc这个变量保留1位小数,<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> cc: currency;<br>begin<br> cc := 5.85;<br>end;
如何把cc这个变量保留1位小数,<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> cc: currency;<br>begin<br> cc := 5.85;<br>end;
W wanglong0 Unregistered / Unconfirmed GUEST, unregistred user! 2008-10-05 #2 我这么写为什么不对?得到的结果是5.8,正确答案应该是5.9啊???<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> cc: currency;<br> cc2:currency;<br>begin<br> cc2 := 5.85;<br> cc := strtocurr(Format('%.1f', [cc2]));<br>end;
我这么写为什么不对?得到的结果是5.8,正确答案应该是5.9啊???<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> cc: currency;<br> cc2:currency;<br>begin<br> cc2 := 5.85;<br> cc := strtocurr(Format('%.1f', [cc2]));<br>end;
D duxing Unregistered / Unconfirmed GUEST, unregistred user! 2008-10-09 #8 cc := trunc((cc2 + 0.05),1);