unit Main;

interface

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

type
  TMainForm = class(TForm)
    Panel1: TPanel;
    btnCLOSE: TBitBtn;
    btnStart1: TBitBtn;
    btnStart2: TBitBtn;
    btnStart3: TBitBtn;
    btnStart4: TBitBtn;
    btnStart5: TBitBtn;
    procedure btnStart5Click(Sender: TObject);
    procedure btnStart4Click(Sender: TObject);
    procedure btnStart3Click(Sender: TObject);
    procedure btnStart2Click(Sender: TObject);
    procedure btnStart1Click(Sender: TObject);
    procedure btnCLOSEClick(Sender: TObject);
  private

  public

  end;

var
  MainForm: TMainForm;

implementation
{$R *.dfm}
{------------------------------------------------------------------------------}

procedure TMainForm.btnCLOSEClick(Sender: TObject);
begin
	Close();
end;

procedure TMainForm.btnStart1Click(Sender: TObject);
var
   a     : Double;
   b     : Double;
   wynik : Double;

begin
	a     := 123.45;
	b     := 0.0;
	wynik := 0.0;

   try
      wynik := a / b;
	except
      ShowMessage('Błąd');
   end;
end;

procedure TMainForm.btnStart2Click(Sender: TObject);
var
   a     : Double;
   b     : Double;
   wynik : Double;

begin
	a     := 123.45;
	b     := 0.0;
	wynik := 0.0;

   try
      wynik := a / b;
	except
   	on e : Exception do
      begin
	      ShowMessage('Błąd ' + e.Message);
      end;
	end;
end;

procedure TMainForm.btnStart3Click(Sender: TObject);
var
   a     : Double;
   b     : Double;
   wynik : Double;

begin
	a     := 123.45;
	b     := 0.0;
	wynik := 0.0;

   try
      wynik := a / b;
	except
   	on e : Exception do
   	begin
      	if e.Message = 'EZeroDivide' then
      	begin
         	ShowMessage('Błąd dzielenia przez zero');
         end;
      end;
   end;
end;

procedure TMainForm.btnStart4Click(Sender: TObject);
var
   a     : Double;
   b     : Double;
   wynik : Double;

begin
 	a     := 123.45;
	b     := 0.0;
	wynik := 0.0;

   try
      wynik := a / b;
	except
   	on e : EZeroDivide do
      begin
	      ShowMessage(e.Message);
      end;
   end;
end;

procedure TMainForm.btnStart5Click(Sender: TObject);
var
   a     : Double;
   b     : Double;
   wynik : Double;

begin
  	a     := 123.45;
	b     := 0.0;
	wynik := 0.0;

   try
      wynik := a / b;
	except
		raise Exception.Create('Błąd');
	end;
end;

end.
