rendered paste bodyunit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
var eingabe, tmp:integer;
ausgabe:string;
begin
eingabe:=strtoint(edit1.Text);
ausgabe:='';
repeat
tmp:=eingabe mod 2;
eingabe := eingabe div 2;
ausgabe:=inttostr(tmp)+ausgabe;
until eingabe = 0;
label1.caption :=ausgabe;
end;
procedure TForm1.Button1Click(Sender: TObject);
var eingabe, tmp:integer;
ausgabe:string;
begin
eingabe:=strtoint(edit1.Text);
ausgabe:='';
repeat
tmp:=eingabe mod 16;
eingabe := eingabe div 16;
if tmp < 10
then ausgabe:=inttostr(tmp)+ausgabe
else ausgabe:=chr(tmp+55)+ausgabe;
until eingabe = 0;
label1.caption :=ausgabe;
end;
end.