Warung Online

January 09, 2012

PROGRAM MULTI LIST DENGAN PASCAL

Program ini disebut Multi List, karena program ini menggunakan 2 record dengan masing - masing data yang berbeda. Kemudian kedua record tersebut disatukan dengan menggunakan NIRM sebagai primary key sehingga gabungan data menjadi akurat. Program ini juga dapat menghasilkan 3 buah file, yaitu file Biodata, file NIRM, dan file Daftar Mahasiswa.


LISTING PROGRAM :


PROGRAM MULTI_LIST;

USES CRT;

TYPE RBDT = RECORD

NPM : ARRAY [1..10] OF STRING [18];

NIRM : ARRAY [1..10] OF STRING [8];

NAMA : ARRAY [1..10] OF STRING [15];

ALM : ARRAY [1..10] OF STRING [15];

END;

TYPE RNIRM = RECORD

NIRM2 : ARRAY [1..10] OF STRING [8];

TM2 : ARRAY [1..10] OF STRING [10];

TH2 : ARRAY [1..10] OF STRING [10];

END;

VAR FBDT : ARRAY [1..10] OF RBDT;

FNIRM : ARRAY [1..10] OF RNIRM;

FILES,FILES2,FILES3 : TEXT;

PIL : CHAR;

N : INTEGER;

LABEL RETURN;

PROCEDURE LINES;

VAR K : INTEGER;

BEGIN

FOR K := 1 TO 80 DO

WRITE('-');

END;

PROCEDURE LINES2;

VAR K : INTEGER;

BEGIN

FOR K := 1 TO 50 DO

WRITE('-');

END;

PROCEDURE LINES3;

VAR K : INTEGER;

BEGIN

FOR K := 1 TO 49 DO

WRITE('-');

END;

PROCEDURE INPUT_DATA;

VAR I,J : INTEGER;

BEGIN

CLRSCR;

ASSIGN(FILES,'FILE_BIODATA.TXT');

REWRITE(FILES);

WRITELN(' FILE BIODATA');

WRITELN;

WRITE(' BANYAKNYA DATA : ');READLN(N);

FOR I := 1 TO N DO

BEGIN

WITH FBDT[I] DO

BEGIN

WRITELN(' ');

WRITELN(' DATA KE-',I);

WRITE(' NPM : ');READLN(NPM[I]);WRITELN(FILES,NPM[I]);

WRITE(' NIRM : ');READLN(NIRM[I]);WRITELN(FILES,NIRM[I]);

WRITE(' NAMA : ');READLN(NAMA[I]);WRITELN(FILES,NAMA[I]);

WRITE(' ALAMAT : ');READLN(ALM[I]);WRITELN(FILES,ALM[I]);

END;

END;

CLOSE(FILES);

CLRSCR;

ASSIGN(FILES2,'F_NIRM.TXT');

REWRITE(FILES2);

WRITELN(' FILE NIRM');

WRITELN;

WRITELN(' BANYAKNYA DATA : ',N);

FOR J:= 1 TO N DO

BEGIN

WITH FNIRM[J] DO

BEGIN

WRITELN('');

WRITELN(' DATA KE-',J);

WRITE(' NIRM : ');READLN(NIRM2[J]);WRITELN(FILES2,NIRM2[J]);

WRITE(' TANGGAL MULAI : ');READLN(TM2[J]);WRITELN(FILES2,TM2[J]);

WRITE(' TANGGAL HABIS : ');READLN(TH2[J]);WRITELN(FILES2,TH2[J]);

END;

END;

CLOSE(FILES2);

END;

PROCEDURE VIEW_BIODATA;

VAR I,J : INTEGER;

BEGIN

CLRSCR;

RESET(FILES);

FOR I := 1 TO N DO

BEGIN

WITH FBDT[I] DO

BEGIN

GOTOXY (20,2);WRITELN('FILE BIODATA');

GOTOXY (1,4);LINES2;

GOTOXY (2,5);WRITELN('NO NPM NIRM NAMA ALAMAT ');

GOTOXY (1,6);LINES2;

GOTOXY (2,6+I);WRITE(I:2);

GOTOXY (7,6+I);WRITE(NPM[I]);

GOTOXY (17,6+I);WRITE(NIRM[I]);

GOTOXY (29,6+I);WRITE(NAMA[I]);

GOTOXY (41,6+I);WRITE(ALM[I]);

END;

END;

GOTOXY (1,7+I);LINES2;

CLOSE(FILES);

READLN;

END;

PROCEDURE VIEW_NIRM;

VAR J : INTEGER;

BEGIN

CLRSCR;

RESET(FILES2);

FOR J := 1 TO N DO

BEGIN

WITH FNIRM[J] DO

BEGIN

GOTOXY (19,2);WRITELN('FILE NIRM');

GOTOXY (1,4);LINES3;

GOTOXY (2,5);WRITELN('NO NIRM TGL MASUK TGL HABIS');

GOTOXY (1,6);LINES3;

GOTOXY (2,6+J);WRITE(J:2);

GOTOXY (7,6+J);WRITE(NIRM2[J]);

GOTOXY (20,6+J);WRITE(TM2[J]);

GOTOXY (37,6+J);WRITE(TH2[J]);

END;

END;

GOTOXY (1,7+J);LINES3;

CLOSE(FILES2);

READLN;

END;

PROCEDURE VIEW_DAFTAR_MAHASISWA;

VAR I,J : INTEGER;

BEGIN

CLRSCR;

ASSIGN(FILES3,'DAFTAR_MAHASISWA.TXT');

REWRITE(FILES3);

FOR I := 1 TO N DO

BEGIN

WITH FBDT[I] DO

BEGIN

FOR J := 1 TO N DO

BEGIN

WITH FNIRM[J] DO

BEGIN

GOTOXY (31,2);WRITELN('DAFTAR MAHASISWA');

GOTOXY (1,4);LINES;

GOTOXY (2,5);WRITELN('NO NPM NIRM NAMA ALAMAT TGL MASUK TGL HABIS');

GOTOXY (1,6);LINES;

GOTOXY (2,6+I);WRITE(I:2);

GOTOXY (7,6+I);WRITE(NPM[I]);

GOTOXY (17,6+I);WRITE(NIRM[I]);

GOTOXY (29,6+I);WRITE(NAMA[I]);

GOTOXY (41,6+I);WRITE(ALM[I]);

IF NIRM[I] = NIRM2[J] THEN

BEGIN

GOTOXY (54,6+I);WRITE(TM2[J]);

GOTOXY (69,6+I);WRITE(TH2[J]);

END;

END;

END;

WITH FNIRM[J] DO

BEGIN

WRITELN(FILES3,NPM[I]);

WRITELN(FILES3,NIRM[I]);

WRITELN(FILES3,NAMA[I]);

WRITELN(FILES3,ALM[I]);

WRITELN(FILES3,TM2[J]);

WRITELN(FILES3,TH2[J]);

END;

END;

END;

GOTOXY (1,7+I);LINES;

CLOSE(FILES3);

READLN;

END;

BEGIN

REPEAT

RETURN:

CLRSCR;

GOTOXY (9,3);WRITELN('<<< MENU FILE >>>');

GOTOXY (4,5);WRITELN('1. FILE BARU DAN INPUT DATA');

GOTOXY (4,6);WRITELN('2. TAMPILKAN FILE BIODATA');

GOTOXY (4,7);WRITELN('3. TAMPILKAN FILE NIRM');

GOTOXY (4,8);WRITELN('4. TAMPILKAN DAFTAR MAHASISWA');

GOTOXY (4,9);WRITELN('5. SELESAI');

GOTOXY (4,12);WRITE('PILIHAN ANDA : ');READLN(PIL);

IF NOT (PIL IN ['1'..'5']) THEN

BEGIN

WRITELN(CHAR(7));

GOTOXY (23,13);WRITELN('PILIHAN SALAH !!!');

READLN;

GOTO RETURN;

END;

CASE PIL OF

'1' : INPUT_DATA;

'2' : VIEW_BIODATA;

'3' : VIEW_NIRM;

'4' : VIEW_DAFTAR_MAHASISWA;

END;

UNTIL PIL = '5';

END.



CATATAN :

NPM : Nomor Pokok Mahasiswa

NIRM, NIRM2 : Nomor Induk Registrasi Mahasiswa

ALM : Alamat

RBDT : Record BIODATA

RNIRM :Record NIRM

FBDT : FILE BIODATA

FNIRM : FILE NIRM



OUTPUT :


MENU PROGRAM



MENU 1 :

INPUT FILE BIODATA
(Dalam pengisian NIRM pada FILE BIODATA, harus diingat agar data 'sama' dengan NIRM pada FILE NIRM)





INPUT FILE NIRM
(Seperti FILE BIODATA, dalam pengisian NIRM, harus 'sama' dengan NIRM pada FILE BIODATA)




MENU 2 :

TAMPILAN FILE BIODATA




MENU 3 :

TAMPILAN FILE NIRM



MENU 4 :

TAMPILAN FILE DAFTAR MAHASISWA