suma macierzy


unit Unit1;

interface

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

type
TForm1 = class(TForm)
sg1: TStringGrid;
sg2: TStringGrid;
b_wypelnij: TButton;
b_dodaj: TButton;
sg3: TStringGrid;
procedure b_wypelnijClick(Sender: TObject);
procedure dodaj(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
x,y: integer;
implementation

{$R *.DFM}

procedure TForm1.b_wypelnijClick(Sender: TObject);
begin
randomize;
for x:=0 to sg1.colcount do
for y:=0 to sg1.rowcount do sg1.cells[x,y]:=inttostr(random(100));
for x:=0 to sg2.colcount do
for y:=0 to sg2.rowcount do sg2.cells[x,y]:=inttostr(random(100));
end;

procedure tform1.dodaj(Sender: TObject);
begin
for x:=0 to form1.sg1.colcount do
for y:=0 to form1.sg1.rowcount do
form1.sg3.cells[x,y]:=inttostr(strtoint(form1.sg1.cells[x,y])+strtoint(form1.sg2.cells[x,y]));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
for x:=0 to sg1.colcount do
for y:=0 to sg1.rowcount do
begin
sg1.cells[x,y]:='0';
sg2.cells[x,y]:='0';
end;
end;

end.

Wyszukiwarka

Podobne podstrony:
Suma przekątnej macierzy
zachowania macierzynskie klaczy i ich nieprawidlowosci
macierz0750
model Lesli ego, macierz Markowa
Tom Clancy Suma wszystkich strachow t 2
Komórki macierzyste tkanek zęba i możliwości odtwarzania struktur zęba
Macierze
matematyka notatki macierze

więcej podobnych podstron