uses crt;
type arrint=array[1..100] of real;
procedure tukar(var a,b :real);
var bantu:real;
begin
bantu:=a;
a:=b;
b:=bantu;
end;
procedure selectionsort(var x:arrint;n:integer);
var i,j:integer;
begin
for i:=1 to n-1 do
for j:=i+1 to n do
if x[i]>x[j] then
tukar(x[i],x[j]);
end;
var
data:arrint;
i,j,n:integer;
begin
clrscr;
writeln('Masukan data bis!');writeln;
write('Berapakah Frekuensi data anda? ');readln(n);
writeln('Silakan masukan data yang anda punya !');
for i:=1 to n do
begin
write('data ke-',i,'=');readln(data[i]);
end;
selectionsort(data,n);
for i:=1 to n do
writeln('(',data[i]:4:2,'),');writeln;
write('nomer bis yang keluar :');readln(n);
readln;
end.
Tidak ada komentar:
Posting Komentar