unit Main;

interface

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

type
  TForm2 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    lblWYNIK: TLabel;
    MainMenu1: TMainMenu;
    Akcja1: TMenuItem;
    Koniecpracy1: TMenuItem;
    StatusBar1: TStatusBar;
    procedure Button1Click(Sender: TObject);
    procedure Edit2Change(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Koniecpracy1Click(Sender: TObject);
  private

  public
	 procedure Oblicz();
  end;

var
  Form2: TForm2;

implementation
{$R *.dfm}
{------------------------------------------------------------------------------}
procedure TForm2.Edit1Change(Sender: TObject);
begin
   lblWYNIK.Caption := '0';
end;

procedure TForm2.Edit2Change(Sender: TObject);
begin
   lblWYNIK.Caption := '0';
end;

procedure TForm2.Koniecpracy1Click(Sender: TObject);
begin
	Close();
end;

procedure TForm2.Button1Click(Sender: TObject);
begin
	Oblicz();
end;

procedure TForm2.Oblicz();
var
	sa     : String;
	sb     : String;
	a      : Integer;
   b      : Integer;
	wynik  : Integer;

begin
	wynik := 0;
	sa    := '';
	sb    := '';
	a     := 0;
	b     := 0;

   a := StrToIntDef(Edit1.Text, 0);
   b := StrToIntDef(Edit2.Text, 0);

   Edit1.Text := IntToStr(a);
   Edit2.Text := IntToStr(b);

   wynik := a * b;

   lblWYNIK.Caption := IntToStr(wynik);
end;

end.

