Показать сообщение отдельно
  #7  
Старый 23.12.2010, 21:07
whitehustle whitehustle вне форума
Прохожий
 
Регистрация: 18.12.2010
Сообщения: 17
Репутация: 12
По умолчанию

без изменений.

вот код, если это поможет

Код:
type matrix= array [0..2, 0..2] of real;

    var
  Form1: TForm1;
  A, B, C: matrix;
  i, j, m, n, l, k: byte;
  s: real;

procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Cells[0, 0]:='0';
StringGrid1.Cells[0, 1]:='0';
StringGrid1.Cells[0, 2]:='0';
StringGrid1.Cells[1, 0]:='0';
StringGrid1.Cells[1, 1]:='0';
StringGrid1.Cells[1, 2]:='0';
StringGrid1.Cells[2, 0]:='0';
StringGrid1.Cells[2, 1]:='0';
StringGrid1.Cells[2, 2]:='0';
StringGrid2.Cells[0, 0]:='0';
StringGrid2.Cells[0, 1]:='0';
StringGrid2.Cells[0, 2]:='0';
StringGrid2.Cells[1, 0]:='0';
StringGrid2.Cells[1, 1]:='0';
StringGrid2.Cells[1, 2]:='0';
StringGrid2.Cells[2, 0]:='0';
StringGrid2.Cells[2, 1]:='0';
StringGrid2.Cells[2, 2]:='0';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
n:=2;
m:=2;
l:=2;
for i:=0 to n do
for j:=0 to m do A[i, j]:=StrToFloat(StringGrid1.Cells[j, i]);
for i:=0 to n do
for j:=0 to m do B[i, j]:=StrToFloat(StringGrid2.Cells[j, i]);
for i:=0 to n do
for j:=0 to l do
begin
s:=0;
for k:=0 to m do
s:=s+A[k,i]*B[j,k];
C[j,i]:=s;
end;
for i:=0 to n do
for j:=0 to m do
StringGrid3.Cells[i, j]:=FloatToStrf(C[j, i], fffixed,2,1);

end;
__________________
Новичок в этом деле.
Ответить с цитированием