资 源 简 介
Delphi 返回指定数值的绝对值,计算正负数绝对值的例子,FloatToStr(Abs)函数用法代码,示例中计算了小数、整数两种数据类型的绝对值,单击对应的箭头,即可查看计算结果,对应的三种计算方法,请参见以下代码:
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Edit2.Text := FloatToStr(Abs(-1.5));
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
Edit4.Text := FloatToStr(Abs(-200));
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
Edit6.Text := FloatToStr(Abs(-1.80));
end;