Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //fpc 3.0.0
- program task2;
- var a : array[1..100, 1..100] of integer;
- b, c : array[1..100] of integer;
- i, j, n, m, t, pos : integer;
- begin
- {read(m, n);
- for i := 1 to m do
- begin
- for j := 1 to n do
- read(a[i, j]);
- readln;
- end;}
- m := 2;
- n := 5;
- for i := 1 to n do
- begin
- a[1, i] := random(100);
- a[m, i] := random(100);
- b[i] := a[1, i];
- c[i] := i;
- end;
- for i := 1 to m do
- begin
- for j := 1 to n do
- write(a[i, j], ' ');
- writeln;
- end;
- writeln;
- writeln;
- for i := 1 to n - 1 do
- begin
- pos := i;
- for j := i + 1 to n do
- begin
- if b[pos] > b[j] then
- pos := j;
- end;
- t := b[i];
- b[i] := b[pos];
- b[pos] := t;
- t := c[i];
- c[i] := c[pos];
- c[pos] := t;
- end;
- for i := 1 to m do
- begin
- for j := 1 to n do
- write(a[i, c[j] ], ' ');
- writeln;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement