uses
crt;
const
str=4;
col=4;
var
a:array [1..str,1..col] of integer;
i,j,temp:integer;
begin
clrscr;
writeln('Формирование массива:');
for i:=1 to str do
begin
for j:=1 to col do
begin
a[i,j]:=random(8)-4;
write(a[i,j]:2,' ')
end;
writeln
end;
for i:=1 to col-1 do
for j:=i+1 to col do
if a[1,i]>a[i,j] then
begin
temp:=a[1,i];
a[1,i]:=a[1,j];
a[1,j]:=temp
end;
writeln('Итоговый массив:');
for i:=1 to str do
begin
for j:=1 to col do
write(a[i,j]:2,' ');
writeln
end;
end.