怎么样把二进制数据转化为十进制数据?急!!!!!

解决方案 »

  1.   

    你的二进制数据用什么表现的,字节的位?integer?char?
      

  2.   

    //求二進位值轉十進位字串
    //DEMO:Get2to10('11011'):= 27;
    function Get2to10(S: string): Double;
    var
      i, Len: Integer;
    begin
      Result := 0;
      Len := Length(S);
      for i := 1 to Len do
      begin
        if Pos(Copy(S, i, 1), '10') = 0
          then
        begin
          Result := 0;
          Break;
        end
        else
          Result := Result + StrToInt(Copy(S, i, 1)) * (Power(2, (Len - i)));
      end;
    end;
      

  3.   

    power函数怎么加进去?Uses Math;
      

  4.   

    power函数怎么加进去?
    你要在uses里加上Math
    uses Math;
    有问题请发信息到我的E-mail:[email protected]
      

  5.   

    我试过了,可以的!
    有问题请发信息到我的E-mail:[email protected]