uses wincrt;
type tipelarik=array [1..100] of real;
var e,c,m,aw,ak:integer;
d:tipelarik;
procedure tukarkan(var a,b:real);
var t:real;
begin
t:=a;
a:=b;
b:=t;
end;
procedure qs(var a:tipelarik; aw,ak:integer);
var i,j:integer;
procedure atur;
begin
i:=aw+1;
j:=ak;
while a[i]
while a[j]>a[aw] do dec(j);
while i
begin
tukarkan(a[i],a[j]);
while a[i]
while a[j]>a[aw] do dec(j);
end;
tukarkan(a[aw],a[j]);
end;
begin {procedure qs}
if aw
begin
atur;
qs(a,aw,j-1);
qs(a,j+1,ak);
end;
end;
begin
write('jumlah data');readln(m);
for e:=1 to m do
readln(d[e]);
qs(d,1,m);
for c:=1 to m do
writeln(d[c]:0:0)
end.
0 komentar:
Posting Komentar