unit Unit_15;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
    procedure PowerXtoY(x, y: Cardinal);overload;
    procedure PowerXtoY(var x, y: Integer);overload;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.PowerXtoY(var x, y: Integer);
var
  i,z: Integer;
begin
  z:=1;
  for i:=1 to y do
   begin
     z:=z*x;
     Memo1.Lines.Add(IntToStr(x)+' do potęgi '+
                     IntToStr(i)+'='+IntToStr(z));
   end;
end;
//---------------------------------------------------------
procedure TForm1.PowerXtoY(x, y: Cardinal);
var
  i,z: Cardinal;
begin
  z:=1;
  for i:=1 to y do
   begin
     z:=z*x;
     Memo1.Lines.Add(IntToStr(x)+' do potęgi '+
                     IntToStr(i)+'='+IntToStr(z));
   end;
end;
//---------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var a, b: Integer;
begin
  Memo1.Clear();
  a:=3;b:=10;
  PowerXtoY(a,b);   //wywołanie przez zmienną
end;
//---------------------------------------------------------
procedure TForm1.Button3Click(Sender: TObject);
begin
  Memo1.Clear();
  PowerXtoY(2, 10); //wywołanie przez wartość
end;
//---------------------------------------------------------
procedure TForm1.Button2Click(Sender: TObject);
begin
   Application.Terminate();
end;

end.
