怎么把DBEDIT3.text中的数字,如果小于0.5就取0.5,大于或等于就不变,最后转换成整数形式并显示出来。

解决方案 »

  1.   

    try
      if StrToFloat(DBEdit3.Text)<0.5 then
        DBEdit3.Text := '0.5';
    except
    end;
      

  2.   

    转换成整数形式是什么意思?
    round()//四舍五入
    trunc()//取整
      

  3.   

    FormatFloat('0.00', 6.666);
    返回6.67
      

  4.   


      if StrToFloat(DBEdit3.Text)<0.5 then
        DBEdit3.Text := '0.5'
      else begin
       edit3.text:=inttostr(round(strtofloat(dbedit3.text));end;
      

  5.   

    if StrToFloat(DBEdit3.Text)<0.5 then
        DBEdit3.Text := '0.5'
      else begin
       edit3.text:=inttostr(round(strtofloat(DBEdit3.text));
    end;
    应该没有问题吧!!!!