Function
DecToBasex(Decimal:LongInt;const Base:Byte):string;
const Symboles: String[16] = '0123456789ABCDEF';
Var nom: String;
a: Byte;
begin
nom:= '';
repeat a:=Decimal mod Base;
nom:=Symboles[a+1]+nom;
Decimal := Decimal div Base;
until(Decimal=0);
Result := nom;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.caption:=DecToBasex(12,16);
//transforme le chiffre 12 en decimal
en base 16
//le resultat est C
end;
|