1. Source Code
Uses Crt;
Var
JenisFile :
Text;
Nm,ALmt,Telp: String;
Tanya :
Char;
Pil :
ShortInt;
Begin
Repeat
ClrScr;
Writeln;
Writeln('
MENU UTAMA');
Writeln(' =============================');
Writeln(' | 1. Membuat File Data |');
Writeln(' | 2. Memasukan Data |');
Writeln(' | 3. Menampilkan Data |');
Writeln(' | 0. Keluar |');
Writeln(' =============================');
Write('Menu pilihan : '); Readln(Pil);
Case Pil Of
1 : Begin
Assign(JenisFile,'Alamat.dat');
ReWrite(JenisFile);
Close(JenisFile);
Writeln('File data berhasil dibuat !');
readln;
End;
2 : Begin
Assign(JenisFile,'Alamat.dat');
Append(JenisFile);
Repeat
ClrScr;
Write(' Nama
: ');Readln(Nm);
Write(' Alamat
: ');Readln(Almt);
Write(' Telepon
: ');Readln(Telp);
Writeln(JenisFile,Nm);
Writeln(JenisFile,Almt);
Writeln(JenisFile,Telp);
Writeln;
Write('Apakah ingin menginput lagi ? (Y/T): ');
Tanya := Readkey;
Until UpCase(Tanya) = 'T';
Close(JenisFile);
Writeln('Data sudah dimasukkan !');
readln;
End;
3 : Begin
Assign(JenisFile,'Alamat.dat');
Reset(JenisFile);
Repeat
Readln(JenisFile,Nm);
Readln(JenisFile,Almt);
Readln(JenisFile,Telp);
ClrScr;
Writeln(' Nama
: ',Nm);
Writeln(' ALamat
: ',ALmt);
Writeln(' Telepon
: ',Telp);
Writeln;
If Nm = '' Then
Tanya := 'T'
Else
Begin
Write('Apakah ingin melihat data berikut (Y/T) : ');
Tanya := ReadKey;
End;
Until UpCase(Tanya) = 'T';
Close(JenisFile);
End;
Else
End;
Until Pil=0;
End.
|