Cari Blog Ini

Minggu, 15 Januari 2012

Tugas SOD "PEMROGRAMAN MULTI LIST pada TPascal"

  • Berikut ini adalah contoh program database menggunakan turbo pascal, program ini berbentuk Biodata Mahasiswa dimana data mahasiswa diperoleh dari 2 type yang berisi file mahasiswa dan file nirm.
SC program:

uses crt;
type
filebio = record
npm:string[8];
nirm:string[3];
nama:string[15];
alamat:string[10];
end;
filenirm = record
nirm2:string[3];
masuk:string[10];
akhir:string[10];
end;
var
biodata :array[1..10] of filebio;
tglnirm :array[1..10] of filenirm;
isi:text;
a,x,y:integer;


Procedure tbio;
begin
a:=5;
assign(isi,'biodata2.dat');
reset(isi);
writeln('Biodata');
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
writeln('| Npm | Nirm | Nama | Alamat |');
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
for x:=1 to 10 do
begin
readln(isi,biodata[x].npm);
readln(isi,biodata[x].nirm);
readln(isi,biodata[x].nama);
readln(isi,biodata[x].alamat);
write('* ',biodata[x].npm,' * ',biodata[x].nirm,' * ',biodata[x].nama,' ',biodata[x].alamat:5);
gotoxy(60,a);
writeln('*');
a:=a+1;
end;
close(isi);
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
readln;
end;

procedure tnirm;
begin
assign(isi,'filenirm.dat');
reset(isi);
writeln('File Nirm');
writeln('-----------------------------------------------------');
writeln('| Nirm | Tanggal Masuk | Tanggal Akhir |');
writeln('-----------------------------------------------------');
for x := 1 to 10 do
begin
readln(isi,tglnirm[x].nirm2);
readln(isi,tglnirm[x].masuk);
readln(isi,tglnirm[x].akhir);
writeln('* ',tglnirm[x].nirm2,' * ',tglnirm[x].masuk,' * ',tglnirm[x].akhir,' *');
end;
writeln('+++++++++++++++++++++++++++++++++++++++++++++++++++++');
close(isi);
readln;
end;


procedure daftarsiswa;
begin
a:=5;
gotoxy(1,30);writeln('Daftar Siswa');
writeln('+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
writeln('| No | Npm | Nirm | Nama | Tgl masuk | Tgl Akhir |');
writeln('+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
for x := 1 to 10 do
begin
write('* ',x,' * ',biodata[x].npm,' * ',biodata[x].nirm,' * ',biodata[x].nama,' *',' *',' *');
for y := 1 to 10 do
if biodata[x].nirm = tglnirm[y].nirm2 then
begin
gotoxy(46,a);
writeln(tglnirm[y].masuk);
gotoxy(60,a);
writeln(tglnirm[y].akhir);
a:=a+1;
end;
end;
writeln('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++');
readln;
end;

begin
clrscr;tbio;
clrscr;tnirm;
clrscr;daftarsiswa;
end.


Data Recordnya :

BIODATA

39110729
100
Mahardika
Depok 2
32102938
101
Aa gym
Jakarta
53892340
102
Boby leslet
Kelapa dua
45810229
103
caiby
Kukusan
32291038
104
David
Jakarta
29230239
105
Efendy
Depok
83402340
106
Fitri
Depok
33802432
107
Gilang
Jakarta
13520342
108
Bhitca
kelapa dua
29834022
109
Jamil
Depok

file NIRM :

100
15/12/2011
16/12/2014
101
24/05/2008
25/05/2011
102
23/10/2006
24/10/2010
103
03/03/2003
04/03/2006
104
07/05/2008
08/05/2012
105
05/06/2011
06/06/2014
106
21/05/2012
22/05/2017
107
18/07/2010
19/07/2013
108
13/04/2007
14/04/2010
109
23/04/2008
24/04/2012

Print screen program outputnya :

BIODATA



FILE NIRM



Result show




TERIMA KASIH ...
GBus