Program mas_6;
uses crt;
const
size_row = 4;
size_col = 7;
type
trow = array[1 .. size_row] of integer;
tmatrix = array[1 .. size_col] of trow;
procedure swap_cols(var mx: tmatrix;
const i, j: integer);
var T: trow;
begin
T := mx[i]; mx[i] := mx[j]; mx[j] := T
end;
procedure print(var mx: tmatrix);
var i, j: integer;
begin
for i := 1 to size_row do
begin
for j := 1 to size_col do
write(mx[j][i]:4);
writeln
end;
end;
var
mx : tmatrix;
i, j : integer;
n, z : integer;
t : text;
r: array [1..500] of Real;
s: Real;
ArrayOfInteger: Array [1..100, 1..100] of Integer;
begin
clrscr;
n := 0;
assign (t, 'input.txt');
reset (t);
for i := 1 to size_col do
for j := 1 to size_row do
read (t, mx[i][j]);
close (t);
for i := 1 to size_col do
for j := 1 to size_row do
if mx[i][j] > n then begin
n := mx[i][j];
z := i;
end;
if z = 1 then
writeln ('max : ');
writeln('ishodn. matrica:'); print(mx);
swap_cols(mx, 1, z);
writeln('polushilos:');
print(mx);
assign (t, 'output.txt');
rewrite (t);
for i := 1 to size_col do begin
writeln (t);
for j := 1 to size_row do
write (t, mx[i][j]);
end;
close (t);
readkey;
end.
Максимум в матрице |