Скачиваний:
74
Добавлен:
23.06.2014
Размер:
1.54 Кб
Скачать
program Matrix;
uses CRT;
const MatSize=10;
var
mat:Array [0..MatSize-1, 0..Matsize-1] of integer;
x,y,max,i:Integer;
s:string;
begin clrscr;
Writeln(' -----------------------------------');
Writeln('Џа®Ја ¬¬  Ї®бв஥­Ёп ўҐЄв®а  ¬ ваЁжл');
Writeln('-------------------------------------');
Writeln('„«п § Ї®«­Ґ­Ёп ¬ ббЁў  ўагз­го ­ ¦¬ЁвҐ Enter,');
Writeln ('¤«п  ўв®§ Ї®«­Ґ­Ёп ­ ¦¬ЁвҐ Їа®ЎҐ« Ё Enter');
Readln(s);
for y:=0 to MatSize-1 do begin
for x:=0 to MatSize-1 do begin
if s=' ' then begin
mat[x,y]:= Random(10); {‡ Ї®«­Ґ­ЁҐ ¬ ваЁжл б«гз ©­л¬Ё зЁб« ¬Ё}
end else begin
Write('‚ўҐ¤ЁвҐ зЁб«®'); {ўў®¤Ёвм §­ зҐ­Ёп 100 а §}
Readln(mat[x,y]);{­г¦­® Ўл Їа®ўҐапвм, зв® ўў®¤пвбп в®«мЄ® жЁдал.}
end;
end;
end;
{‚лў®¤ ¬ ваЁжл ­  нЄа ­}
for y:=0 to MatSize-1 do begin
for x:=0 to MatSize-1 do begin
write(mat[x,y], chr(32));
end;
writeln;{­ з вм б ­®ў®© бва®ЄЁ}
end;
writeln;
{Џ®бв஥­ЁҐ ўҐЄв®а }
for i:=0 to (MatSize-1)*2 do begin
if i<=MatSize-1 then
begin
x:=i;
y:=MatSize-1;
end else begin
y:=(MatSize-1)*2-i;
x:=MatSize-1;
end;
max:=0;
while(x>=0) and(y>=0) do begin
if mat[x,y]>max then max:=mat[x,y];{®ЇаҐ¤Ґ«Ґ­ЁҐ ¬ ЄбЁ¬г¬ }
if((x=0) and (y=MatSize-1)) or ((x=MatSize-1) and(y=0)) then max:=mat[x,y];
x:=x-1;
y:=y-1;
end;
write(max,chr(32));
end;
Writeln;
Writeln;
Writeln('„«п § ўҐа襭Ёп ­ ¦¬ЁвҐ Enter');
Readln;
end.