Uses crt;
Var
nama: array[1..50] of string;
npm: array[1..50] of string;
kelas : array[1..50] of string;
ipk: array[1..50] of string;
i,j,n : byte;
t: boolean;
jawab: char;
const garis=’----------------------------------------------------------------------------------------------‘;
begin
repeat
t:=false
clrscr;
write(‘masukkan jumlah data:’);readln(n);
for i:= 1 to n do
begin
clrscr;
writeln(‘data ke-‘,i);
write(‘nama :’);readln(nama[i]);
write(‘npm :’);readln(npm[i]);
write(‘kelas :’);readln(kelas[i]);
write(‘ipk :’);readln(ipk[i]);
writeln;
end;
for i:= 1 to n-1 do
begin
for j:= i to n do
begin
if kelas[j] < kelas[i] then
begin
temp := nama[j];
nama[j]:=nama[i];
nama[i]:=temp;
temp := npm[j];
npm[j]:=npm[i];
npm[i]:=temp;
temp := kelas[j];
kelas[j]:=kelas[i];
kelas[i]:=temp;
temp := ipk[j];
ipk[j]:=ipk[i];
ipk[i]:=temp;
end;
end;
end;
clrscr;
for i:= 1 to n do
begin
writeln(‘===data mahasiswa===’);
writeln(garis);
writeln(‘nama npm kelas ipk’);
writeln(garis);
for i:= 1 to n do
begin
gotoxy(1,4+i);write(nama[i]);
gotoxy(16,4+i);write(npm[i]);
gotoxy(31,4+i);write(kelas[i]);
gotoxy(46,4+i);write(ipk[i]);
end;
end;
writeln;
writeln(garis);
writeln;
write(‘akan proses lagi[y/t] ?’);readln(jawab);
until(jawab)=’t’;
end.
Tidak ada komentar:
Posting Komentar