Задан двухмерный массив. расположить все элементы матрицы в строку в порядке возрастания: ( в чем ошибка? программа не идет): program niv; const n=2; m=2; var i,j,d: integer; c: real; a: array[1..m,1..n] of real; begin for i: =1 to n do; begin a[i,j]: =random (10)-5; a[i,j]: =random (10)-5; writeln(a[i,j]); end; for i: =1 to m do begin for j: =1 to n-1 do begin for d: =1 to n-j do begin if a[i,d]> a[i,d+1]then begin c: =a[i,d]; a[i,d]: =a[i,d+1]; a[i,d+1]: =c; end; end; end; end; writeln('сортировка'); for i: =1 to m do begin for j: =1 to n do begin writeln(a[i,j]); writeln(a[2,j]); end; end; end.
const n=4; m=4;
var i,j,d:integer;
c:real;
a:array[1..m,1..n] of real;
begin
Randomize;
for i:=1 to m do
begin
for j:=1 to n do
begin
a[i,j]:=random(10)-5;
write(a[i,j]:3);
end;
writeln;
end;
for i:=1 to m do
for j:=1 to n-1 do
for d:=1 to n-j do
if a[i,d]>a[i,d+1]then begin
c:=a[i,d];
a[i,d]:=a[i,d+1];
a[i,d+1]:=c;
end;
writeln('сортировка');
for i:=1 to m do
begin
for j:=1 to n do write(a[i,j]:3);
writeln;
end;
end.