unit Unit1;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

function convert(s:string):string;
var
  i,err:longint;
  num:int64;
  newS,tStr:string;
begin
  val(s,num,err);
  if err>0 then
  begin
    showMessage('Число введено неверно');
    result:='';
    exit;
  end;
  newS:='';
  while num>0 do
  begin
    str(num mod 8,tStr);
    newS:=tStr+newS;
    num:=num div 8;
  end;
  result:=newS;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.Text:='1';
  Edit2.Clear;
end;

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

end.
