Tampilan program pada saat input data mahasiswa :
Tampilan program pada saat mencetak data :
Sintaks program Array dan Record (Program Tabel Mahasiswa):
recmhs= record
{Prosedur pengurutan data berdasarkan nilai mahasiswa}
{Prosedure mencetak data mahasiswa}
Tampilan program pada saat mencetak data :
Sintaks program Array dan Record (Program Tabel Mahasiswa):
uses wincrt;
type recttl= record
tmp : string[8];
tgl : 1..31;
bln : 1..12;
thn : integer;
end;
nim : string;
nama : string;
prodi: string;
ttl : recttl;
nilai: real;
end;
var i,n: integer;
mhs: array [1..10] of recmhs;
procedure input_data; {Prosedur input data mahasiswa}
begin
for i:=1 to n do
with mhs[i],ttl do
begin
writeln('Mahasiswa ',i);
write('NIM :'); readln(nim);
write('Nama :'); readln(nama);
write('Program studi :'); readln(prodi);
write('Tempat lahir :'); readln(tmp);
write('Tanggal lahir (1-30 :'); readln(tgl);
write('Bulan Lahir (1-12) :'); readln(bln);
write('Tahun Lahir :'); readln(thn);
write('Nilai :'); readln(nilai);
writeln;
end;
end;
procedure urut_data;
var tukar: recmhs;
j : integer;
begin
for i:=1 to n-1 do
for j:=i+1 to n do
if mhs[i].nilai < mhs[j].nilai then
begin
tukar := mhs[i];
mhs[i]:= mhs[j];
mhs[j]:= tukar;
end;
end;
procedure cetak_data;
begin
clrscr;
writeln(' Tabel Mahasiswa Universitas Teknologi Yogyakarta ');
writeln(' Fakultas Informations Technology and Business ');
writeln(' Program Studi Teknik Informattika ');
writeln;
writeln('_______________________________________________________________________________');
writeln('| NIM | Nama | Program Studi | TTL |Nilai|');
writeln('-------------------------------------------------------------------------------');
for i:=1 to n do
with mhs[i],ttl do
begin
write('|',nim:10,'|',nama:20,'|',prodi:18,'|',tmp:8,', ',tgl:2,'/',bln:2,'/',thn:4,'|',nilai:3:2,'|');
end;
writeln('-------------------------------------------------------------------------------');
end;
{Program utama}
begin
write('Banyaknya Mahasiswa = '); readln(n);
input_data;
urut_data;
cetak_data;
end.
Created by:
Nama : Arifianto
NIM : 3105111314
Prodi / Kelas : Teknik Informatika / D