Quote
№ студ.билета 07005 значит 0+2=2 получается 2 строчки и 7 столбцов
Вот молодец! Держи решение:
Code
uses crt;
const
n=2;
FName='C:\1.txt';
type
Arr=array[1..n,1..7] of integer;
{============================================================================}
Procedure PackMatrix(var E:Arr;var F:text);
var
i,j:byte;
temp:integer;
begin
Randomize;
for i:=1 to n do
begin
for j:=1 to 7 do
begin
temp:=Random(21)-10;
E[i][j]:=temp;
Write(F,temp:4);
Write(temp:4);
end;
WriteLn(F);
WriteLn;
end;
end;
{============================================================================}
function FindMax(E:Arr):byte;
var
i,j,nMax:byte;
Max:integer;
begin
nMax:=1;
Max:=E[1][1];
for i:=1 to 7 do
for j:=1 to n do
if E[j][i]>Max then
begin
Max:=E[j][i];
nMax:=i;
end;
FindMax:=nMax;
end;
{============================================================================}
var
E:Arr;
F:text;
Max,i:byte;
Sum:integer;
begin
ClrScr;
Assign(F,FName);
ReWrite(f);
PackMatrix(E,F);
Max:=FindMax(E);
Sum:=0;
for i:=1 to n do
if E[i][Max]<0 then
Inc(Sum,E[i,Max]);
WriteLn(F,Max,Sum:5);
WriteLn(Max,Sum:5);
Close(f);
ReadKey;
end.