Uses Wincrt;
Type Siswa = Record
Nm : String[15];
Ni : String[14];
TTL : String[25];
Jsk : String [10];
Alm : String [25];
JK :String [10];
Ag:string[10];
SA: string[20];
AS: String[25];
End;
Var
FilePsb : File of Siswa;
Data:Siswa;
Pil,Pilihan,Ul : Char;
Procedure Menu;
begin
Screensize.X := 116 ;
Screensize.Y := 40;
Clrscr;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(36,2);Write('SELAMAT DATANG DI PROGRAM PENDATAAN SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(44,5);Write('===========================');
Gotoxy(52,6);Write('MENU PILIHAN');
Gotoxy(44,7);Write('===========================');
Gotoxy(45,9);Write('(1).TAMBAH DATA SISWA BARU');
Gotoxy(45,11);Write('(2).TAMPIL DATA SISWA BARU');
Gotoxy(45,13);Write('(3).VIEW DATA SISWA BARU');
Gotoxy(45,15);Write('(4).EDIT DATA SISWA BARU');
Gotoxy(45,17);Write('(5).HAPUS DATA');
Gotoxy(45,19);Write('(6).KELUAR');
Gotoxy(44,20);Write('===========================');
Gotoxy(45,21);Write('PILIHAN [1..6] : ');Pil:=Readkey;
End;
Procedure Bukafile;
Begin
Assign(FilePsb,'Psb.Dat');{$i-};
Reset(FilePsb);{$i-};
End;
Procedure Tambah;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: string;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
ReWrite(FilePsb);
Repeat
Clrscr;
Ada:=false;
i:=0;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(50,2);Write('TAMBAH DATA SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(24,4);Write('Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And(i<>Filesize(FilePsb))Do
begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If Data.Ni=NOCR Then
Ada:=True
Else
inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(39,14);Write('NOMOR URUT = ''',NOCR,'''Ini Sudah Ada!');
End
Else
Begin
Seek(FilePsb,Filesize(FilePsb));
Data.Ni:=NOCR;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Lengkap (Sesuai Ijazah) : ');Readln(Data.Nm);
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin(L:Laki-laki dan P:Perempuan) : ');Readln(data.JK);
if(Data.JK='L')or (Data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,11);Write('jenis kelamin anda: ',data.Jsk);
Gotoxy(22,12);write('-----------------------------------------------------------------------------');
Gotoxy(24,13);Write('Agama : ');Readln(data.Ag);
Gotoxy(22,14);write('-----------------------------------------------------------------------------');
Gotoxy(24,15);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(22,16);write('-----------------------------------------------------------------------------');
Gotoxy(24,17);Write('Sekolah Asal : ');Readln(data.Sa);
Gotoxy(22,18);Write('=============================================================================');
Write(FilePsb,Data);
End;
Gotoxy(49,20);Write('Mau Tambah Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FilePsb);
End;
Procedure Tampil;
Var
i:Integer;
Begin
Ul:='Y';
BukaFile;
If IoResult<>0 Then
Write('Maaf Data Masih kosong !')
Else
Begin
Clrscr;
Writeln;
gotoxy(51,1);writeln('_______________');
Gotoxy(50,2);Writeln('[DATA SISWA BARU] ');
Writeln;
Writeln('============-=====================================================================================================');
Writeln('NO| NISN | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JNIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Inc(i);
Read(FilePsb,data);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
writeln('==================================================================================================================');
End;
Close(FilePsb);
End;
Writeln;
Write('Press Any Key To Continue...');Readkey;
End;
Procedure View_NSIN;
Var
i:Integer;
NI:string;
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NI);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Ni=NI Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_Nama;
Var
i:Integer;
Nama:String[17];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nama:');Readln(Nama);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Nm=Nama Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_jsk;
Var
i:Integer;
JSK:String[10];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Jenis Kelamin : ');Readln(jsk);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' DATA SISWA MENURUT JENIS KELAMIN ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.jsk=JSK Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Writeln;
Writeln;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Procedure View;
Var
Pilihan:Char;
Begin
Clrscr;
Gotoxy(48,10);Write('===========================');
Gotoxy(50,11);Write(' VIEW DATA SISWA BARU');
Gotoxy(48,12);Write('===========================');
Gotoxy(48,13);Write(' 1. View Nomor Induk Siswa');
Gotoxy(48,14);Write(' 2. View Nama Siswa');
Gotoxy(48,15);Write(' 3. View Jenis Kelamin');
Gotoxy(48,16);Write('===========================');
Gotoxy(50,17);Write('Pilihan [1..3] : ');Pil:=ReadKey;
if Pil='1'then View_NSIN;
if Pil='2'then View_Nama;
if Pil='3'then View_Jsk;
End;
Procedure edit;
Var
Lagi: char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Bukafile;
If IOResult<>0 Then
Write('Data masih kosong...!')
else
begin
repeat
Clrscr;
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | EDIT DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(24,4);Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Begin
Ada:=True;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------')
End
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Data.Ni:=NOCR;
Gotoxy(51,18);write('__________________');
Gotoxy(50,19);write('| EDIT DATA SISWA |');
Gotoxy(51,20);write('------------------');
Gotoxy(24,21);Write('Nama Siswa : ');Readln(Data.Nm);
Gotoxy(24,22);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(24,23);Write('Jenis Kelamin( L : Laki-laki dan P :Perempuan : ');Readln(data.JK);
if(Data.JK='L')or (data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,24);Write('jenis kelamin anda : ',data.jsk);
Gotoxy(24,25);Write('Agama : ');Readln(data.ag);
Gotoxy(24,26);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(24,27);Write('Sekolah Asal : ');Readln(data.sa);
Write(' ===============================================================================================================');
Seek(FilePsb,i);
Write(FilePsb,Data);
End
Else
Begin
Gotoxy(24,30);Write('NISN''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(24,31);Write('Mau Edit Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FilePsb);
End;
Procedure Hapus;
Var
FileTmp : File of Siswa;
Lagi,Hapus:char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
Bukafile;
If IOResult<>0 Then
Write('data masih kosong...!')
else
Begin
Clrscr;
Assign(FileTmp,'Psb.tmp');
ReWrite(FileTmp);
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | HAPUS DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(22,4);Write('MASUKKAN NOMOR INDUK SISWA : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Ada:=True
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------');
Gotoxy(22,18);Write('Apakah Data Ini Mau Di Hapus ??? [Y/T]:');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i:=1 to filesize(FilePsb) Do
Begin
seek(FilePsb,i-1);
Read(FilePsb,Data);
If Data.Ni<>NOCR Then
Write(FileTmp,Data);
End;
Close(FilePsb);
Assign(FilePsb,'Psb.Dat');
Erase(FilePsb);
Assign(fileTmp,'Psb.tmp');
Rename(FileTmp,'Psb.Dat');
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(22,20);Write('Mau Hapus Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Begin
Repeat
Menu;
Case Pil Of
'1': Tambah;
'2': Tampil;
'3': View;
'4': Edit;
'5': Hapus;
End;
Until(Ul<>'Y') Or (Pil='6');
DoneWincrt;
End.
Type Siswa = Record
Nm : String[15];
Ni : String[14];
TTL : String[25];
Jsk : String [10];
Alm : String [25];
JK :String [10];
Ag:string[10];
SA: string[20];
AS: String[25];
End;
Var
FilePsb : File of Siswa;
Data:Siswa;
Pil,Pilihan,Ul : Char;
Procedure Menu;
begin
Screensize.X := 116 ;
Screensize.Y := 40;
Clrscr;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(36,2);Write('SELAMAT DATANG DI PROGRAM PENDATAAN SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(44,5);Write('===========================');
Gotoxy(52,6);Write('MENU PILIHAN');
Gotoxy(44,7);Write('===========================');
Gotoxy(45,9);Write('(1).TAMBAH DATA SISWA BARU');
Gotoxy(45,11);Write('(2).TAMPIL DATA SISWA BARU');
Gotoxy(45,13);Write('(3).VIEW DATA SISWA BARU');
Gotoxy(45,15);Write('(4).EDIT DATA SISWA BARU');
Gotoxy(45,17);Write('(5).HAPUS DATA');
Gotoxy(45,19);Write('(6).KELUAR');
Gotoxy(44,20);Write('===========================');
Gotoxy(45,21);Write('PILIHAN [1..6] : ');Pil:=Readkey;
End;
Procedure Bukafile;
Begin
Assign(FilePsb,'Psb.Dat');{$i-};
Reset(FilePsb);{$i-};
End;
Procedure Tambah;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: string;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
ReWrite(FilePsb);
Repeat
Clrscr;
Ada:=false;
i:=0;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(50,2);Write('TAMBAH DATA SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(24,4);Write('Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And(i<>Filesize(FilePsb))Do
begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If Data.Ni=NOCR Then
Ada:=True
Else
inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(39,14);Write('NOMOR URUT = ''',NOCR,'''Ini Sudah Ada!');
End
Else
Begin
Seek(FilePsb,Filesize(FilePsb));
Data.Ni:=NOCR;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Lengkap (Sesuai Ijazah) : ');Readln(Data.Nm);
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin(L:Laki-laki dan P:Perempuan) : ');Readln(data.JK);
if(Data.JK='L')or (Data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,11);Write('jenis kelamin anda: ',data.Jsk);
Gotoxy(22,12);write('-----------------------------------------------------------------------------');
Gotoxy(24,13);Write('Agama : ');Readln(data.Ag);
Gotoxy(22,14);write('-----------------------------------------------------------------------------');
Gotoxy(24,15);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(22,16);write('-----------------------------------------------------------------------------');
Gotoxy(24,17);Write('Sekolah Asal : ');Readln(data.Sa);
Gotoxy(22,18);Write('=============================================================================');
Write(FilePsb,Data);
End;
Gotoxy(49,20);Write('Mau Tambah Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FilePsb);
End;
Procedure Tampil;
Var
i:Integer;
Begin
Ul:='Y';
BukaFile;
If IoResult<>0 Then
Write('Maaf Data Masih kosong !')
Else
Begin
Clrscr;
Writeln;
gotoxy(51,1);writeln('_______________');
Gotoxy(50,2);Writeln('[DATA SISWA BARU] ');
Writeln;
Writeln('============-=====================================================================================================');
Writeln('NO| NISN | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JNIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Inc(i);
Read(FilePsb,data);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
writeln('==================================================================================================================');
End;
Close(FilePsb);
End;
Writeln;
Write('Press Any Key To Continue...');Readkey;
End;
Procedure View_NSIN;
Var
i:Integer;
NI:string;
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NI);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Ni=NI Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_Nama;
Var
i:Integer;
Nama:String[17];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nama:');Readln(Nama);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Nm=Nama Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_jsk;
Var
i:Integer;
JSK:String[10];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Jenis Kelamin : ');Readln(jsk);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' DATA SISWA MENURUT JENIS KELAMIN ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.jsk=JSK Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Writeln;
Writeln;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Procedure View;
Var
Pilihan:Char;
Begin
Clrscr;
Gotoxy(48,10);Write('===========================');
Gotoxy(50,11);Write(' VIEW DATA SISWA BARU');
Gotoxy(48,12);Write('===========================');
Gotoxy(48,13);Write(' 1. View Nomor Induk Siswa');
Gotoxy(48,14);Write(' 2. View Nama Siswa');
Gotoxy(48,15);Write(' 3. View Jenis Kelamin');
Gotoxy(48,16);Write('===========================');
Gotoxy(50,17);Write('Pilihan [1..3] : ');Pil:=ReadKey;
if Pil='1'then View_NSIN;
if Pil='2'then View_Nama;
if Pil='3'then View_Jsk;
End;
Procedure edit;
Var
Lagi: char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Bukafile;
If IOResult<>0 Then
Write('Data masih kosong...!')
else
begin
repeat
Clrscr;
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | EDIT DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(24,4);Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Begin
Ada:=True;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------')
End
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Data.Ni:=NOCR;
Gotoxy(51,18);write('__________________');
Gotoxy(50,19);write('| EDIT DATA SISWA |');
Gotoxy(51,20);write('------------------');
Gotoxy(24,21);Write('Nama Siswa : ');Readln(Data.Nm);
Gotoxy(24,22);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(24,23);Write('Jenis Kelamin( L : Laki-laki dan P :Perempuan : ');Readln(data.JK);
if(Data.JK='L')or (data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,24);Write('jenis kelamin anda : ',data.jsk);
Gotoxy(24,25);Write('Agama : ');Readln(data.ag);
Gotoxy(24,26);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(24,27);Write('Sekolah Asal : ');Readln(data.sa);
Write(' ===============================================================================================================');
Seek(FilePsb,i);
Write(FilePsb,Data);
End
Else
Begin
Gotoxy(24,30);Write('NISN''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(24,31);Write('Mau Edit Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FilePsb);
End;
Procedure Hapus;
Var
FileTmp : File of Siswa;
Lagi,Hapus:char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
Bukafile;
If IOResult<>0 Then
Write('data masih kosong...!')
else
Begin
Clrscr;
Assign(FileTmp,'Psb.tmp');
ReWrite(FileTmp);
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | HAPUS DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(22,4);Write('MASUKKAN NOMOR INDUK SISWA : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Ada:=True
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------');
Gotoxy(22,18);Write('Apakah Data Ini Mau Di Hapus ??? [Y/T]:');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i:=1 to filesize(FilePsb) Do
Begin
seek(FilePsb,i-1);
Read(FilePsb,Data);
If Data.Ni<>NOCR Then
Write(FileTmp,Data);
End;
Close(FilePsb);
Assign(FilePsb,'Psb.Dat');
Erase(FilePsb);
Assign(fileTmp,'Psb.tmp');
Rename(FileTmp,'Psb.Dat');
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(22,20);Write('Mau Hapus Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Begin
Repeat
Menu;
Case Pil Of
'1': Tambah;
'2': Tampil;
'3': View;
'4': Edit;
'5': Hapus;
End;
Until(Ul<>'Y') Or (Pil='6');
DoneWincrt;
End.