unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, Unit1;
Const Count:Integer=1;
type
  TForm2 = class(TForm)
    btVal: TButton;
    ValX: TEdit;
    ValY: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    btOk: TBitBtn;
    procedure btOkClick(Sender: TObject);
    procedure btValClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

Type
    Massiv=array[1..100,1..2] of Integer;
    Massiv1=array[1..100]of Real;
var
  Form2: TForm2;
  X,Y,Code:Integer;
  Mas:Massiv;
  Way:Massiv1;
implementation

{$R *.DFM}

procedure TForm2.btOkClick(Sender: TObject);
var i:integer;
    s1,s2:string;
begin
     close;
     Form1.Memo3.Clear;
     For i:=1 to Count do
     begin
          str(mas[i,1],s1);
          str(mas[i,2],s2);
          Form1.Memo3.Text:=Form1.Memo3.Text+'('+s1+', '+s2+')';
     end;
     Form1.Label3.Visible:=true;
     Form1.Memo3.Visible:=True;
end;

procedure TForm2.btValClick(Sender: TObject);
Var b:boolean;
begin
     Count:=Count+1;
     Val(ValX.Text,X,Code);
     If code=0 then b:=true else b:=false;
     Val(ValY.Text,Y,Code);
     if (code=0) and b then
        begin Mas[count,1]:=X;
              Mas[count,2]:=Y;
              Way[Count]:=Sqrt(Sqr(x)+Sqr(y));
        end
     else
       MessageDlg('Îøèáêà!!!'+#13#10+'Ââîäèòå ÷èñëà', mtError, [mbOk], 0);
     ValX.Text:='';
     ValY.Text:='';
end;

end.
