1233.233 是Single 数据类型我要showmessage显示1233.233 但是我不要小数后的部分 怎么写

解决方案 »

  1.   

    来个取整函数啊
    Trunc()
    例如:showmessage(inttostr(trunc(1233.233)))
      

  2.   

    你的意思是格式化输出?
    不明白!
    用这个:var
       val: single;
    begin
       Val := 1233.233 ;
       ShowMessage(FloatToStrF(Val, ffFixed, 10, 0));
    end;
      

  3.   

    你想要什么样的数据类型?
    字符串?还是single?
    这样吧:FloatToStrF返回的结果是字符串,如果你想变为浮点就用strtofloat
    比如:          f:=strtofloat(FloatToStrF(Val, ffFixed, 10, 0)); 
    还有一个格式化函数: FormatFloat('0',Val);返回的结果是字符串,如果Val为1233.233,返回字符1233,
                      而FormatFloat('0.00',Val);返回字符1233.23 
                     f:=strtofloat(FormatFloat('0',Val));