procedure vybor(a:tm);
begin
peres:=0;
srav:=0;
for i:= 1 to n-1 do
begin
k := i;
temp := a [i];
for j := i+1 to n do
begin
inc(srav);
if a [j] < temp then
begin
k := j;
temp := a [j];
end;
end;
a [k] := a [i];
if k <> i then inc(peres);
a [i] := temp;
end;
write('Sortirovka');
textcolor(red);
for i:=1 to n do
write(a[i],' ');
writeln;
textcolor(white);
writeln('Chislo perestanovok = ',peres);
writeln('Chislo sravneniy = ',srav);
readln;
end;
Тегами не забываем пользоваться...
Сообщение отредактировано: volvo -