Насчет сокращения кода:
Код:
var
cp: TComponent;
i: integer;
begin
for i:=1 to 3 do
begin
cp := FindComponent('StringGrid'+IntToStr(i));
if cp <> nil then
begin
(cp as TStringGrid).RowCount:=n;
(cp as TStringGrid).ColCount:=m;
for i:=0 to n-1 do
for j:=0 to m-1 do
begin
A[i,j]:=sin(j)/cos(j)+exp(cos(i));;
(cp as TStringGrid).Cells[j,i]:=FormatFloat('0.00',A[i,j]);
end;
end;
end;
end;
end;
Это код сократит, но что думаю ты разберешся и подкорректируешь как тебе надо
