unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids; type TForm1 = class(TForm) StringGrid1: TStringGrid; Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; Button1: TButton; Button2: TButton; StringGrid2: TStringGrid; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; const Nmax=10; Mmax=10; Type Mas1 = array[1..Nmax,1..Mmax] of extended; Mas2 = array[1..Nmax,1..Mmax] of extended; var Form1: TForm1; A,Y:Mas1; B,X:mas2; N,M:integer; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var i,j:integer; begin N:=4; Edit1.Text:=IntToStr(N); M:=2; Edit2.Text:=IntToStr(M); StringGrid1.ColCount:=M+1; StringGrid1.RowCount:=N+1; StringGrid2.ColCount:=M+1; StringGrid2.RowCount:=N-1; StringGrid1.Cells[0,0]:='Ìàññèâ A:'; StringGrid2.Cells[0,0]:='Ìàññèâ B:'; for i:=1 to N do begin StringGrid1.Cells[0,i]:='i= '+IntToStr(i); StringGrid2.Cells[0,i]:='i= '+IntToStr(i); end; for j:=1 to M do begin StringGrid1.Cells[j,0]:='j= '+IntToStr(j); StringGrid2.Cells[j,0]:='j= '+IntToStr(j); end; end; procedure TForm1.Button1Click(Sender: TObject); var i,j:integer; begin N:=StrToInt(Edit1.Text); M:=StrToInt(Edit2.Text); StringGrid1.ColCount:=M+1; StringGrid1.RowCount:=N+1; for i:=1 to N do begin StringGrid1.Cells[0,i]:='i= '+IntToStr(i); end; for j:=1 to M do begin StringGrid1.Cells[j,0]:='j= '+IntToStr(j); end; end; procedure TForm1.Button2Click(Sender: TObject); var i,j:integer; begin for i:=1 to N do for j:=1 to M do A[i,j]:=StrToFloat(StringGrid1.Cells[j,i]); B[i,j]:=StrToFloat(StringGrid2.Cells[j,i]); for j:=1 to M do begin if i mod 2=0 then a[i,j]:=b[i,j]; StringGrid2.Cells[i,j]:=FloatToStr(b[i,j]); end; end; end.