program sortir menggunakan PASCAL :

 

 

program sortir;

uses crt;

var

name : array[1..100] of string[20];

npm : array [1..100] of string[20];

class : array[1..100] of string[20];

s,d,n : byte;

temp : string;

T: boolean;

jawab : char;

begin

repeat

T:= false;

clrscr;

write(‘insert data : ‘);

readln(n);

for s:= 1 to n do

begin

writeln(‘data ke -‘,s:3);

write(‘name :’);readln(nama[s]);

write(‘class🙂;readln(kelas[s]);

write(‘npm🙂;readlln(npm[s]);

writeln;

end;

for s:= 1 to n-1 do

begin

 for d := s to n do

begin

if (kelas[d] < kelas[s])then

begin

temp := name[d];

name[d]:=name[s];

name[s]:=temp;

temp := npm[d];

npm[d]:= npm[s];

npm[s]:=temp;

temp:= class[d];

class[d]:=class[s];

class[s]:=temp;

end;

end;

end;

writeln;

writeln(‘******************Data Mahasiswa****************’);

writeln(‘=================================’);

writeln(‘NAME                    NPM                CLASS   ‘);

writeln(‘=================================’);

for s:= 1 to n do

begin

writeln(nama[s]:0,npm[s]:16,kelas[s]:9);

end;

end;

writeln(‘=================================’);

writeln;

write(‘lanjutkan proses [y/t] ?’);readln(jawab);

until upcase(jawab)=’T’;

end.

gram sortir menggunakan PASCAL