Тема: потрібно посортувати елементи масиву двовимірного бульбашковм методом!
▼Код
program DlyaVani;
uses
crt, graph;
const
m = 3;
n = 5;
TYPE
MAS = ARRAY[1 .. m, 1 .. n] OF integer;
var
i,j,x: integer;
A1 : MAS;
max,min, row, col : integer;
ca1 : mas;
BEGIN
{Filling in array}
randomize;
FOR I := 1 TO M DO
FOR J := 1 TO N DO
A1[i,j] := random(138);
{Displaying array}
FOR I := 1 TO M DO BeGIN
FOR J := 1 TO N DO
write(A1[I,J], ' ') ;
writeln;
end;
{Calculation the SUM}
FOR i := 1 to m do
FOR j := 1 to n do
x := x + a1[i,j];
writeln('§ Ј «м бг¬ :', x);
{Calculating the SUM of each row}
FOR i := 1 to m do begin
x := 0;
for j := 1 to n do
x := x + A1[i,j];
writeln('бг¬ ', i, '-Ј® ап¤Є : ', x);
end;
{Calculating the sUM of each column}
FOR j := 1 to n do begin
x := 0;
for i := 1 to m do
x := x + A1[i,j];
writeln('бг¬ ', j, '-Ј® бв®ўЇзЁЄ : ', x);
end;
{Filling in array}
FOR i := 1 TO m DO
FOR j := 1 TO n DO BEGIN
IF (i = 1) AND (j = 1) THEN BEGIN
max := a1[i,j];
col := j;
row := i;
END ELSE
IF a1[i,j] > max THEN BEGIN
max := a1[i,j];
col := j;
row := i;
END;
END;
FOR i := 1 TO m DO
FOR j := 1 TO n DO BEGIN
IF (i = 1) AND (j = 1) THEN BEGIN
min := a1[i,j];
col := j;
row := i;
END ELSE
IF a1[i,j] < min THEN BEGIN
min := a1[i,j];
col := j;
row := i;
END;
END;
writeln('¬ ЄбЁ¬ «мҐ § зҐп :', max, ' ' , 'а冷Є ' , row , ' бв®ўЇзЁЄ ', col );
writeln('¬ii¬ «мҐ § зҐп :', min, ' а冷Є ', row, ' бв®ЇзЁЄ ', col );
readln;
END.
ЯК?????