W wjiachun Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-03 #3 没有现成的函数,不过容易转化阿 十进制转换为2进制 [未名码头]>>文章分页 上一篇 下一篇 function DecToBinStr(n: integer): string; var S: string; i: integer; Negative: boolean; begin if n < 0 then Negative := true else Negative := False; n := Abs; for i := 1 to SizeOf * 8 do begin if n < 0 then S := S + '1' else S := S + '0'; n := n shl 1; end; Delete(S,1,Pos('1',S) - 1);//remove leading zeros if Negative then S := '-' + S; Result := S; end;
没有现成的函数,不过容易转化阿 十进制转换为2进制 [未名码头]>>文章分页 上一篇 下一篇 function DecToBinStr(n: integer): string; var S: string; i: integer; Negative: boolean; begin if n < 0 then Negative := true else Negative := False; n := Abs; for i := 1 to SizeOf * 8 do begin if n < 0 then S := S + '1' else S := S + '0'; n := n shl 1; end; Delete(S,1,Pos('1',S) - 1);//remove leading zeros if Negative then S := '-' + S; Result := S; end;