unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 =
class
(TForm)
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
StringGrid1: TStringGrid;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
StringGrid2: TStringGrid;
procedure
Button1Click(Sender: TObject);
procedure
Button2Click(Sender: TObject);
procedure
FormCreate(Sender: TObject);
procedure
Button3Click(Sender: TObject);
procedure
Button4Click(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
A:
array
[
1..21
,
1..21
]
of
extended
;
B:
array
[
1..21
]
of
Extended
;
N,i,j,k:
integer
;
implementation
{$R *.dfm}
procedure
TForm1
.
Button1Click(Sender: TObject);
begin
N:=strtoint(edit1
.
text) ;
StringGrid1
.
RowCount:=n+
1
;
StringGrid1
.
ColCount:=N+
1
;
StringGrid2
.
RowCount:=N+
1
;
StringGrid1
.
Cells[
0
,
0
]:=
'Массив A'
;
StringGrid2
.
Cells[
0
,
0
]:=
'Массив B'
;
StringGrid1
.
Height:=
20
*(n+
1
)+
5
+n;
StringGrid1
.
Width:=
20
*(n+
1
)+
5
+n;
StringGrid2
.
Height:=
20
*(n+
1
)+
5
+n;
for
i:=
1
to
n
do
begin
StringGrid1
.
Cells[
0
,i]:=inttostr(i);
StringGrid1
.
Cells[i,
0
]:=inttostr(i);
end
;
end
;
procedure
TForm1
.
Button2Click(Sender: TObject);
begin
for
i:=
1
to
n
do
begin
For
j:=
1
to
n
do
begin
Stringgrid1
.
Cells[i,j]:=floattostr(random(
50
)-
20
);
Stringgrid1
.
Update;
sleep(
50
);
end
;
end
;
Button3
.
Enabled:=
true
;
end
;
procedure
TForm1
.
FormCreate(Sender: TObject);
begin
N:=
3
;
StringGrid1
.
RowCount:=n+
1
;
StringGrid1
.
ColCount:=N+
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]:=inttostr(i);
StringGrid1
.
Cells[i,
0
]:=inttostr(i);
end
;
end
;
procedure
TForm1
.
Button3Click(Sender: TObject);
begin
begin
for
i:=
1
to
n
do
begin
For
j:=
1
to
n
do
begin
Stringgrid1
.
Cells[i,j]:=
''
;
Stringgrid2
.
Cells[
0
,j]:=
''
;
end
;
end
;
end
;
end
;
procedure
TForm1
.
Button4Click(Sender: TObject);
begin
<b>
<b>
end
;
end
.