Вводишь
1 2 3
1 2 3
1 2 3
Выводит
1 1 1
1 1 2
1 2 3
Вот код:
uses crt;
var M,N : Integer;
type
MyType = Integer;
type
MyMatrix = array [1..1,1..1] of MyType;
TMatrix = ^MyMatrix;
{-----------------------------------------------}
Procedure ReadMatrix(var mx : TMatrix);
var i,j : Integer;
begin
for i := 1 to M do
for j := 1 to N do begin
Write('Element [',i,',',j,']:');
ReadLn(mx^[i,j]);
end;
end;
{-----------------------------------------------}
{-----------------------------------------------}
Procedure WriteMatrix(var mx : TMatrix);
var i,j : Integer;
begin
for i := 1 to M do
for j := 1 to N do begin
Write(mx^[i,j]:3);
if j = N then WriteLn;
end;
end;
{-----------------------------------------------}
var a : TMatrix;
Size : Word;
begin
{$R-}
Clrscr;
Write('Input M:');
ReadLn(M);
Write('Input N:');
ReadLn(N);
Size := M * N * SizeOf(MyType);
GetMem(a,Size);
WriteLn('Input Matrix:');
ReadMatrix(a);
WriteLn;
WriteLn('Source Matrix:');
WriteMatrix(a);
FreeMem(a,Size);
Readkey;
end.
Подскажите что не так...