mam coś takiego tylko to jest dodawanie macierzy, jak to przerobić aby było to mnożenie macierzy
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
m1: TStringGrid;
m2: TStringGrid;
suma: TStringGrid;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j,l:integer;
begin
l:=strToInt(edit1.Text);
for i:=0 to l-1 do
for j:=0 to l-1 do
suma.cells[i,j]:=IntTostr(strToInt(m1.cells[i,j]) + strToInt(m2.Cells[i,j]));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
m1.RowCount:=strToInt(edit1.text);
m1.colCount:=strToInt(edit1.text);
m2.RowCount:=strToInt(edit1.text);
m2.colCount:=strToInt(edit1.text);
suma.RowCount:=strToInt(edit1.text);
suma.colCount:=strToInt(edit1.text);
end;
end.