unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Label1: TLabel;
procedure button1Click(Sender: TObject);
end;
const
zn : string[36] = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var
Form1: TForm1;
implementation
{$R *.dfm}
function Convert(chis:integer;osn:byte):string;
begin
result:='';
repeat
result:=zn[(chis mod osn)+1] + result;
chis:=chis div osn;
until chis=0;
end;
procedure TForm1.button1Click(Sender: TObject);
var s:string;
intc,frcc:integer;
osn:byte;
begin
s:=Edit1.text;
osn:=StrToint(Edit2.Text);
if pos(',',s)<>0 then
begin
intc:=Strtoint(copy(s,1,pos(',',s)-1));
frcc:=Strtoint(copy(s,pos(',',s)+1,length(s)-pos(',',s)));
Label1.Caption:=Convert(intc,osn)+','+Convert(frcc,osn);
end
else if pos(',',s)=0 then
Label1.Caption:=Convert(StrToInt(s),osn);
end;
end.