浮点型数据如何转换为整型数据???
如:我要将62*0.6转化为整型数据37,现在没有现成的函数,应如何转化???
在线等,急,谢谢!!

解决方案 »

  1.   

    double a = 0.6;
    int b = 62;
    int c;
    c = b*a;
      

  2.   

    double a = 0.6;
    int b = 62;
    int c;
    a = b*a;
    c = a;
      

  3.   

    Int
       返加一个实数年的整数部分!
       showmessage(floattostr(int(62*0.6)));  //返回37Round
       四舍五入!
       showmessage(floattostr(Round(62*0.6)));   //返回37Floor    //用此函数须 uses    math
       把实数向下圆整为整数!
       showmessage(floattostr(Floor(62*0.6)));   //返回37Trunc
       把实数向零圆整为整数!
       showmessage(floattostr(Trunc(62*0.6)));   //返回37
    都可以
    看你用哪一个啦!
      

  4.   

    Round
    Integer
    Trunc
    都可以,但有区别
      

  5.   

    Trunc(62*0.6)
    大哥,一人只能分1分了,还不结
      

  6.   

    Trunc(62*0.6+0.5)这样四舍五入不会错