#Cooding Program
PROGRAM
SORT;
uses
crt;
var
nama: array[1..30] of string;
NPM: array[1..30] of string;
kelas: array[1..30] of string;
a,b,x: byte;
temp : string;
T: boolean;
jawab: char;
const garis='---------------------------------';
begin
repeat
T:=false;
clrscr;
readln(x);
for a:= 1 to x do
begin
write('Data ke-',a:2,'');readln;
write('Nama :');readln(nama[a]);
write('NPM
:');readln(NPM[a]);
write('Kelas :');readln(kelas[a]);
writeln;
end;
for
a:= 1 to x-1 do
begin
for
b:= a to x do
begin
if(kelas[b]<kelas[a]) then
begin
temp:= nama[b];
nama[b]:= nama[a];
nama[a]:= temp;
temp:= NPM[b];
NPM[b]:= NPM[a];
NPM[a]:= temp;
temp:= kelas[b];
kelas[b]:= kelas[a];
kelas[a]:= temp;
end;
end;
end;
writeln;
writeln('Data
Setelah Disortir:');
begin
writeln;
writeln('***Data
Mahasiswa***');
writeln(garis);
writeln('NAMA NPM KELAS');
writeln(garis);
for
a:= 1 to x do
begin
writeln(nama[a]:0,NPM[a]:16,kelas[a]:9);
end;
end;
writeln(garis);
writeln;
write('Apakah akan memproses
lagi[Y/T]?');readln(jawab);
until upcase(jawab)='T';
end.
# Hasil Output
#Hasil Sortiran
*Link untuk mendownload program tersebut :
:: SILAHKAN MENCOBA J ::
Tidak ada komentar:
Posting Komentar