1.09.2012

PROGRAM MULTI LIST MENGGUNAKAN PASCAL

  • Listing Program
Program Multilist;
uses crt;
type rdt = record
    npm : array [1..10] of string [8];
    nirm : array [1..10] of string [6];
    nama : array [1..10] of string [15];
    alamat : array [1..10] of string [15];
    end;
type rnirm = record
    nirm2 : array [1..10] of string [6];
    tglm : array [1..10] of string [11];
    tgla : array [1..10] of string [11];
    end;

var
fdt : array[1..10] of rdt;
fnirm : array[1..10] of rnirm;
file1 : text;
file2 : text;
pil : char;
i : integer;

label return;

procedure inputdata;
var j,k : integer;
begin
clrscr;
assign (file1, 'fd.txt');
rewrite (file1);
writeln;
writeln ('   >>File Biodata<<');
writeln ('  -------------------');
writeln (file1, ' >>File Biodata<<');writeln (file1);
writeln;
write ('   Banyak Data : '); readln(i);writeln (file1,'   Banyak Data : ',i);
for j := 1 to i do

begin
with fdt[j]do
begin
writeln(' '); writeln(file1);
writeln(' Data ke: ',j); writeln(file1,' Data ke: ',j);
write(' NPM    : '); readln(npm[j]);
writeln(file1, ' NPM    : ',npm[j]);
write(' NIRM   : '); readln(nirm[j]);
writeln(file1, ' NIRM   : ',nirm[j]);
write(' Nama   : '); readln(nama[j]);
writeln(file1, ' Nama   : ',nama[j]);
write(' Alamat : '); readln(alamat[j]);
writeln(file1, ' Alamat : ',alamat[j]);
end;
end;
close(file1);

clrscr;
assign(file2, 'fn.txt');
rewrite(file2);
writeln;
writeln('   >>File NIRM<<');
writeln('  ---------------');
writeln;
writeln(file2, ' >>File NIRM<<');
writeln(file2);
writeln('   Banyak Data : ',i); writeln(file2,'   Banyak Data : ',i);
for k:= 1 to i do
begin
with fnirm[k] do
begin
writeln(' '); writeln(file2);
writeln(' Data ke: ',k); writeln(file2,' Data ke: ',k);
write(' NIRM      : '); readln(nirm2[k]); writeln(file2,' NIRM : ',nirm2[k]);
write(' TGL-MASUK : '); readln(tglm[k]); writeln(file2,' TGL-MASUK : ',tglm[k]);
write(' TGL-AKHIR : '); readln(tgla[k]); writeln(file2,' TGL-AKHIR : ',tgla[k]);
end;
end;
close (file2);
end;

Procedure Garis;
var a : integer;
begin
for a:= 1 to 76 do
write('~');
end;

Procedure FileNirm;
var j,k : integer;
begin
clrscr;
for j := 1 to i do
begin
for k := 1 to i do
begin
with fdt[j]do
begin
with fnirm[k]do
begin
if nirm[j]=nirm[k] then
begin
gotoxy (10,6+j); write(tglm[j]);
gotoxy (22,6+j); write(tgla[j]);
end else
end;
end;
gotoxy (12,2); writeln('File NIRM');
gotoxy (2,4); writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
gotoxy (2,5); writeln('| NIRM | TGL-MASUK | TGL-AKHIR |');
gotoxy (2,6); writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
gotoxy (2,6+j); write('|');
gotoxy (3,6+j); write(nirm[j]);
gotoxy (9,6+j); write('|');
gotoxy (21,6+j); write('|');
gotoxy (33,6+j); write('|');
end;
end;
end;
gotoxy(2,7+j); writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
readln;
end;

Procedure FileBiodata;
var j,k : integer;
begin
clrscr;
for j := 1 to i do
begin
for k := 1 to i do
begin
with fdt[j]do
begin
with fnirm[k]do
begin
if nirm[j]=nirm[k] then
begin

end;
end;
gotoxy (19,2); writeln('File Biodata');
gotoxy (2,4); writeln ('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
gotoxy (2,5); writeln ('|   NPM  | NIRM |      NAMA     |    ALAMAT     |');
gotoxy (2,6); writeln ('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
gotoxy (2,6+j); write('|');
gotoxy (3,6+j); write(npm[j]);
gotoxy (11,6+j); write('|');
gotoxy (12,6+j); write(nirm[j]);
gotoxy (18,6+j); write('|');
gotoxy (19,6+j); write(nama[j]);
gotoxy (34,6+j); write('|');
gotoxy (35,6+j); write(alamat[j]);
gotoxy (50,6+j); write('|');
end;
end;
end;
gotoxy(2,7+j);writeln ('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
readln;
end;

Procedure DaftarMahasiswa;
var j,k : integer;
begin
clrscr;
for j := 1 to i do
begin
for k := 1 to i do
begin
with fdt[j]do
begin
with fnirm[k]do
begin
if nirm[j]=nirm[k] then
begin
gotoxy (54,6+j); write(tglm[j]);
gotoxy (66,6+j); write(tgla[j]);
end else
end;
end;
gotoxy (32,2); writeln('Data Mahasiswa');
gotoxy (2,4); garis;
gotoxy (2,5); writeln('|NO|   NPM  | NIRM |      NAMA     |    ALAMAT     | TGL-MASUK | TGL-AKHIR |');
gotoxy (2,6); garis;
gotoxy (2,6+j); write('|');
gotoxy (3,6+j); write(j:2);
gotoxy (5,6+j); write('|');
gotoxy (6,6+j); write(npm[j]);
gotoxy (14,6+j); write('|');
gotoxy (16,6+j); write(nirm[j]);
gotoxy (21,6+j); write('|');
gotoxy (22,6+j); write(nama[j]);
gotoxy (37,6+j); write('|');
gotoxy (38,6+j); write(alamat[j]);
gotoxy (53,6+j); write('|');
gotoxy (65,6+j); write('|');
gotoxy (77,6+j); write('|');
end;
end;
end;
gotoxy(2,7+j); garis;
readln;
end;

begin
repeat
return:
clrscr;
gotoxy (10,3); writeln('Pilihan');
gotoxy (5,4); writeln('===================');
gotoxy (5,6); writeln('1. Input Data');
gotoxy (5,7); writeln('2. File Biodata');
gotoxy (5,8); writeln('3. File NIRM');
gotoxy (5,9); writeln('4. Daftar Mahasiswa');
gotoxy (5,10); writeln('5. exit');
gotoxy (5,12); writeln('Masukan Pilihan : '); readln(pil);
if not ( pil in ['1'..'5']) then
begin
writeln (char (13));
gotoxy (7,13); writeln('-Ulangi Pilihan Anda-');
readln;
goto return;
end;

case pil of
'1' : inputdata;
'2' : FileBiodata;
'3' : FileNirm;
'4' : DaftarMahasiswa;
end;
until pil = '5';
end.
OutputNya sebagai berikut :







*Mata kuliah Struktur & Organisasi Data