unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Math;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

Function perevod(slovo:string):extended;
var base,j,r,i:integer; 
begin;
  base:=10;
  Result:=0;
  j:=0;
  for i:=length(slovo) downto 1 do
  begin
    case slovo[i] of
      'a','A' : r:=10;
      'b','B' : r:=11;
      'c','C' : r:=12;
      'd','D' : r:=13;
      '0'..'9': r:=StrToInt(slovo[i]);
    end;
    Result:=Result+r*power(base,j);
    j:=j+1;
  end;  
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then Edit2.Text:=FloatToStr(perevod(Edit1.Text));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.Clear;
  Edit2.Clear;
end;

end.
