Program Pengurutan Data

Program Pegurutan Data


program urutkan_data;
uses wincrt;

type
    nassroom=string;

var
   i,j:byte;
   temp:nassroom;
   lagi:char;
   data:array[1..10] of nassroom;

begin
lagi:='y';
repeat
clrscr;

for i:=1 to 10 do

begin
     write('Masukkan Data ke - ',i,' : ');readln(data[i]);
end;

for i:= 1 to 10-1 do
for j:= i to 10 do

if data[i]>data[j]  then
begin
     temp:=data[i];
     data[i]:=data[j];
     data[j]:=temp;
end;

clrscr;
writeln(' Data Setelah di urutkan');
writeln('-------------------------');
writeln;
writeln;

for i:=1 to 10 do
    writeln(i:2,'. ',data[i]);

writeln;
write('Ulangi ? (Y/T) : ');readln(lagi);
until (lagi='t')or(lagi='T');
donewincrt;
end.
Comments
0 Comments