Program p_10;
const N=10;
Type mass=array[1..N] of integer;
Var a:mass;
PROCEDURE VVOD(var H:mass);
Var i:integer;
begin
For i:=1 To 10 Do H:=random(100);
end;
PROCEDURE VIVOD(H:mass);
Var i:integer;
begin
For i:=1 To 10 Do begin Write(H, ); end;
end;
PROCEDURE SWAP(S,T:integer);
Var U:integer;
Begin
U:=T; T:=S; S:=U;
End;
PROCEDURE SORT(var b:mass);
Var max,i,j,k:integer;
Begin
For i:=1 to N-1 Do Begin
max:=b; k:=i;
For j:=i+1 to N Do If b[j]>max then begin
max:=b[j];
k:=j;
end;
SWAP(b, b[k]);
End;
End;
BEGIN
VVOD(a); VIVOD(a);
writeln;
SORT(a); VIVOD(a);
writeln;
END.
const N=10;
Type mass=array[1..N] of integer;
Var a:mass;
PROCEDURE VVOD(var H:mass);
Var i:integer;
begin
For i:=1 To 10 Do H:=random(100);
end;
PROCEDURE VIVOD(H:mass);
Var i:integer;
begin
For i:=1 To 10 Do begin Write(H, ); end;
end;
PROCEDURE SWAP(S,T:integer);
Var U:integer;
Begin
U:=T; T:=S; S:=U;
End;
PROCEDURE SORT(var b:mass);
Var max,i,j,k:integer;
Begin
For i:=1 to N-1 Do Begin
max:=b; k:=i;
For j:=i+1 to N Do If b[j]>max then begin
max:=b[j];
k:=j;
end;
SWAP(b, b[k]);
End;
End;
BEGIN
VVOD(a); VIVOD(a);
writeln;
SORT(a); VIVOD(a);
writeln;
END.