function TenToX (a,x : integer) : longint;
var
r : string := '';
begin
while a > 0 do
begin
r := IntToStr(a mod x) + r;
a := a div x;
end;
Result := StrToInt (r);
end;
function XToTen (a,x : integer) : integer;
var
l,i,r : integer;
s : string;
begin
s := IntToStr (a);
l := Length (s);
for i := 1 to l do
begin
r := r + StrToInt (s[i]) * trunc (power(x,l-i));
end;
Result := r;
end;
function XToTen (a: string; x : integer) : integer;
var
i,l,r : integer;
begin
l := Length (a);
for i := 1 to l do
begin
r := r + StrToInt (a[i]) * trunc (power(x,l-i));
end;
Result := r;
end;
|