F fhuibo Unregistered / Unconfirmed GUEST, unregistred user! 2009-02-04 #4 procedure TForm1.Button1Click(Sender: TObject);var s1,s2:string; //s1是10进制,s2是二进制 ,把s1转成s2 m:integer;begin s1:=edit1.text; m:=strtoint(s1); while m<>0 do begin if m=(m div 2)*2 then s2:='0' +s2 else s2:='1'+s2; m:=m div 2; end; edit2.Text:=s2;end;
procedure TForm1.Button1Click(Sender: TObject);var s1,s2:string; //s1是10进制,s2是二进制 ,把s1转成s2 m:integer;begin s1:=edit1.text; m:=strtoint(s1); while m<>0 do begin if m=(m div 2)*2 then s2:='0' +s2 else s2:='1'+s2; m:=m div 2; end; edit2.Text:=s2;end;
F foam Unregistered / Unconfirmed GUEST, unregistred user! 2009-02-04 #5 repeat s2:=inttostr(m and 1)+s2; m:=m div 2; until m=0;