Program pointerDataMhs;
Uses crt;
Const max = 100;
Type penunjukmhs = ^catatanmhs;
catatanmhs = record
nim : string[8];
nama : string[20];
ipk : real;
end;
var
datamhs : array[1..max] of penunjukmhs;
temp : real;
tempp : string;
i, n, j : byte;
pil : char;
x: integer;
procedure isiData;
begin
writeln(’****************’);
writeln(’Data Mahasiswa :’);
writeln(’****************’);
writeln(’Nim Nama Ipk’);
writeln;
for i:=1 to n do
with datamhs[i]^ do
writeln(nim:5,nama:10,ipk:10:2);
end;
begin
clrscr;
write(’Masukkan Banyak Data Mahasiswa : ‘); readln(n);
writeln;
for i:=1 to n do
begin
writeln;
writeln(’Mahasiswa ke ‘, i:2, ‘:’);
new(datamhs[i]);
with datamhs[i]^ do
begin
write(’Nim mahasiswa : ‘); readln(nim);
write(’Nama mahasiswa : ‘); readln(nama);
write(’Ipk mahasiswa : ‘); readln(ipk);
end;
end;
clrscr;
x:=0;
clrscr;
‘1′ : begin
temp:=0;
for i:=1 to n-1 do
for j:=n downto i+1 do
begin
if datamhs[j]^.nama < datamhs[j-1]^.nama
then
begin
tempp := datamhs[j]^.nama;
datamhs[j]^.nama := datamhs[j-1]^.nama;
datamhs[j-1]^.nama := tempp;
tempp := datamhs[j]^.nim;
datamhs[j]^.nim := datamhs[j-1]^.nim;
datamhs[j-1]^.nim := tempp;
temp := datamhs[j]^.ipk;
datamhs[j]^.ipk := datamhs[j-1]^.ipk;
datamhs[j-1]^.ipk := temp;
end;
end;
isidata;
end;
end;
readln;
end.