请指教? 我是菜鸟real 如何转换为 String ?
或者 其他型也可,只要能在程序中显示出来就ok拉!!!

解决方案 »

  1.   

    FloatToStr(伏点类型):String;
      

  2.   

    函数
    Function RealToStr (R :Real) :String;
    const MAS = 10000000;
          MIS = 0.0000001;
    var Z :String;
        EF :Boolean;
        c :Char;
    begin
       if ((Abs (R) < MAS) and (Abs (R) > MIS)) or (R = 0) then
       begin
          Str (R:17:16, Z);
          EF:= False;
          while not EF do
          begin
             c:= Z [Length (Z)];
             if (c = '0') or (c = '.')
             then Z:= Copy (Z, 1, Length (Z) - 1)
             else EF:= True;
             if (c = '.') or (Length (Z) <= 1) then EF:= True;
          end;
          while Z [1] = ' ' do Z:= Copy (Z, 2, Length (Z) - 1);
       end
       else
       begin
          Str (R, Z);
          while Z [1] = ' ' do Z:= Copy (Z, 2, Length (Z) - 1);
       end;
       RealToStr:= Z;
    end;
      

  3.   

    大家都已经说过了,我就不重复了,他们说的都对!flattostr()
      

  4.   

    哎,来晚喽!!!哎,来晚喽!!!哎,来晚喽!!!哎,来晚喽!!! 
    floattostr()floattostr()floattostr()floattostr()floattostr()floattostr()
      

  5.   

    real类型已经不被推荐使用了,
    用Single或者Double吧。