Код:
program zad;
const MAX=50;
type MAS=Array[1..Max,1..Max] of real;
MASC=Array[1..(MAX*(MAX-1)) DIV 2] OF REAL;
var
D,E,F: MAS;
Q,R,T: MASC;
G,O,W: integer;
S,A,B: integer;
i,j:integer;
procedure avtor;
begin
writeln('Avtor: Grigor Ivanov');
writeln('Fak. No, EMF, ');
writeln;
end;
procedure uslovie;
begin
writeln('Uslovie...');
writeln;
end;
procedure vhod(var x:Mas; var y:integer);
begin
write('Vuvedete broi red i stulbove');
readln(y);
for i:=1 to y do
for j:=1 to y do
repeat
write('[',i,',',j,']=');
readln(x[i,j]);
until ((x[i,j]>-1000) and (x[i,j]<1000));
end;
Procedure Izhod(x:mas; y:integer);
begin
writeln('Izvejdane na vhodq6ti danni:');
for i:=1 to y do
begin
for j:=1 to y do
write (x[i,j]:2:2,' ');
writeln;
end;
end;
Procedure Action(x:mas; k,y:integer; var c:masc);
begin
K:=1;
FOR I:=2 TO Y DO
FOR J:=1 TO I-1 DO
BEGIN
C[K]:=X[I,J];
K:=K+1;
END;
end;
{ SORTIRAME MASIVA "C" }
Procedure Sortirovka (x:mas; m:integer; var c:masc);
begin
FOR I:=2 TO M DO
BEGIN
X[I,J]:=C[I];
J:=I-1;
WHILE (X[I,J]<C[J]) AND (J>0) DO
BEGIN
c[J+1]:=c[J];
J:=J-1;
END;
c[J+1]:=x[i,j];
END;
{ IZVEJDAME SORTIRANIQ MASIV }
writeln;
writeln('Sorirani elementi pod glavniq diagonal:');
For I:=1 to M do
write(C[I]:2:2,' ');
readln
end;
begin
avtor;
uslovie;
writeln('Rabota s masiva D:');
vhod(D,G);
izhod(D,G);
action(D,G,S,Q);
sortirovka(D,G,Q);
readln ;
writeln('Rabota s masiv E:');
vhod(E,O);
izhod(E,O);
action(E,O,A,R);
sortirovka (E,O,R);
readln;
writeln('Rabota s Masiv F:');
vhod(F,W);
izhod(F,W);
action(F,W,B,T);
sortirovka(F,W,T);
readln
end.
Дава грешни резултати