adapun isi biodatamhs.dat seperti berikut:
31111101
120
fauzi maulana
Depok
32211102
121
dona gagas
Depok
32311103
122
hasan bafar
Kelapa dua
32411104
123
jadas sada
kelapa dua
32511105
124
safas dafa
Jakarta
32611106
125
sacaf dasa
Depok
32711107
126
dasaw hahagaf
Depok
32811108
127
dafa fdasa
garut
32911109
128
caca dadasa
kelapa dua
33011110
129
gadahasil fad
jakarta
adapun isi dari filenirm.dat :
120
11 12 2010
12 12 2013
121
11 05 2010
12 05 2013
122
11 10 2010
12 10 2013
123
13 03 2010
14 03 2013
124
17 05 2010
18 05 2013
125
15 06 2010
16 06 2013
126
11 05 2010
11 05 2013
127
13 07 2010
13 07 2013
128
19 04 2010
20 04 2013
129
28 04 2010
29 04 2013
adapun listing programnya sebagai berikut:
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,'biodatamhs.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;
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.
jika input yang dimasukkan benar,maka outputnya seperti gambar di bawah ini :
lalu tekan enter,maka akan keluar output seperti gambar di bawah ini:
lalu tekan enter untuk melihat hasil penggabungan sebagian data
Tidak ada komentar:
Posting Komentar