Program mandiri Bag. (3)

oleh : 
arif zainurrohman
danni setiadi
sepdia mautia putri




End
                           Else
                               Inc(i);
                           End;
                               If (Ada=True) Then
                                  Begin
                                       Data.Kdmember:=NOCR;
                                       x:=46;y:=7;
                                       tiga:
                                       Gotoxy(X,y+5);Write('Status Ruangan : ');readln(Data1.status);
                                       if (Data1.status='') then
                                          goto tiga;
                                          Seek(Filetempat,i);
                                          Write(Filetempat,Data1);
                                  End
                               Else
                                   Begin
                                        Gotoxy(20,13);Write('Kode Ruangan Atau Jenis Ruangan Ini Tidak Ada!');
                      End;
                Gotoxy(24,17);Write('Apakah Mau Edit Data Lain [Y/T]: ');Lagi:=Upcase(Readkey);
          Until Lagi<>'Y';
          End;
Close(Filetempat);
End;
Procedure Hapus;
Var
FileTmp      : File of karaoke;
   Lagi,Hapus   : Char;
   Ada          : Boolean;
   i            : Integer;
   NOCR         : Word;

Begin
     Lagi:='Y';
     Clrscr;
     title;
Repeat
      BukaFile;
      If IOResult<>0 Then
         Write('Data Masih Kosong...!')
      Else
          Begin
               Clrscr;
               title;
               Assign(FileTmp,'karaoke.tmp');
               Rewrite(FileTmp);
               Ada:=False;
               i:=0;
               x:=31;y:=6;
               Gotoxy(x+2,y);Write('HAPUS DATA MEMBER');

 Gotoxy(x+1,y+1);Write('-----------------');
               Gotoxy(x,y+2);Write('Kode Member : ');Readln(NOCR);
               While (Ada=False) And (i<>Filesize(Filekaraoke)) Do
                     Begin
                          Seek(Filekaraoke,i);
                          Read(Filekaraoke,Data);
                          If Data.Kdmember=NOCR Then
                             Ada:=True
                          Else
                              Inc(i);
                          End;
                          If (Ada=True) Then
                          Begin
                               Gotoxy(X,y+3);Write('Nama : ');writeln(Data.nama);
                               Gotoxy(x-8,y+9);Write('Apakah Data Ini Mau Di Hapus [Y/T]: ');Readln(Hapus);
                               If Upcase(Hapus)='Y' Then
                                  Begin
                                       For i := 1 to Filesize(Filekaraoke) Do
                                       Begin
        Seek(Filekaraoke,i-1);
                                            Read(Filekaraoke,Data);
                                            If Data.Kdmember<>NOCR Then
                                                Write(FileTmp,Data);
                                       End;
                                  Close(Filekaraoke);
                                  Assign(Filekaraoke,'karaoke.txt');
                                  Erase(Filekaraoke);
                                  Assign(FileTmp,'karaoke.tmp');
                                  Rename(FileTmp,'karaoke.txt');
                                  Gotoxy(x-8,y+9);Write(' Member ',NOCR,' Sudah Di Hapus! ');
                                  End;
                               End
                          Else
                          Begin
                               Gotoxy(x-4,y+9);Write('Member ',NOCR,' Ini Tidak Ada!');
                          End;
                     Gotoxy(x-3,y+10);Write('Mau Hapus Data Lain [Y/T]: ');Lagi:=Upcase(Readkey);
                     End;
          Until Lagi<>'Y';
End;

Procedure Hapus1;
Var
   FileTemp   : File of tempat;
   Lagi,Hapus : Char;
   Ada        : Boolean;
   i          : Integer;
   NOCR       : Word;
Begin
     Lagi:='Y';
     Clrscr;
     title;
     Repeat
           Buka;
           If IOResult<>0 Then
              Write('Data Masih Kosong...!')
           Else
               Begin
                    Clrscr;
                    title;
                    Assign(FileTemp,'tempat.tmp');
                    Rewrite(FileTemp);
                    Ada:=False;
                    i:=0;
                    x:=31;y:=6;
                    Gotoxy(x+2,y);Write('HAPUS DATA RUANGAN');
                    Gotoxy(x+1,y+1);Write('-----------------');
                    Gotoxy(x,y+2);Write('Kode Ruangan : ');Readln(NOCR);
                    While (Ada=False) And (i<>Filesize(Filetempat)) Do
                          Begin                              
        Seek(Filetempat,i);
                               Read(Filetempat,Data1);
                               If Data1.Kdruang=NOCR Then
                                  Ada:=True
                               Else
                                   Inc(i);
                               End;
                                   If (Ada=True) Then
                                      Begin
                                      Gotoxy(X,y+3);Write('Ruangan : ');writeln(Data1.jenis);
                                      Gotoxy(x-8,y+9);Write('Apakah Data Ini Mau Di Hapus [Y/T]: ');Readln(Hapus);
                                      If Upcase(Hapus)='Y' Then
                                         Begin
                                         For i := 1 to Filesize(Filetempat) Do
                                         Begin
                                              Seek(Filetempat,i-1);
                                              Read(Filetempat,Data1);
                                              If Data1.Kdruang<>NOCR Then
                                                 Write(FileTemp,Data1);
                                              End;
                                              Close(Filetempat);
                                              Assign(Filetempat,'tempat.txt');
                                              Erase(Filetempat);
                                              Assign(FileTemp,'tempat.tmp');
                                              Rename(FileTemp,'tempat.txt');
                                              Gotoxy(x-8,y+9);Write(' Ruangan ',NOCR,' Sudah Di Hapus! ');
                                         End;
                                      End
                                   Else
                                    Begin
                                   Gotoxy(x-4,y+9);Write('Ruangan ',NOCR,' Ini Tidak Ada!');
                                   End;
                                   Gotoxy(x-3,y+10);Write('Mau Hapus Data Lain [Y/T]: ');Lagi:=Upcase(Readkey);
                          End;
           Until Lagi<>'Y';
End;

Procedure Tampil;
Var
   i,n : Integer;
Begin
     clrscr;
     title;
     BukaFile;
     If IOResult <> 0 Then
        Begin
            gotoxy(30,11);
            Write('Maaf Data Masih Kosong ! ');
        end
     Else
         Begin
         Clrscr;
         title;
         x:=7;y:=9;
         gotoxy(x+26,y-3); write('.::DATA MEMBER::.');
         gotoxy(x,y-2); write(garsed2);
         gotoxy(x,y-1); writeln('|No|KODE| NAMA                     |');
         gotoxy(x,y); write(garsed1);
         i:=0;
         While Not EoF(Filekaraoke) Do
               Begin
                    Inc(i);
                    Read(Filekaraoke,Data);
                    gotoxy(x,y+i); write('| ',i);
                    gotoxy(x+3,y+i); write('|'); writeln(data.kdmember);
                    gotoxy(x+8,y+i); write('|'); writeln(data.nama);
                    gotoxy(x+35,y+i); write('|');
               End;
         Close(Filekaraoke);
     End;
Writeln;
writeln(garspas);
Write(' Tekan Enter untuk Kembali Kemenu Utama');Readln;
End;
Procedure Tampil1;
Var
   i,n : Integer;
Begin
     clrscr;
      title;
     Buka;
If IOResult <> 0 Then
   begin
        gotoxy(30,11);
        Write('Maaf Data Masih Kosong ! ');
   end
Else
Begin
     Clrscr;
     title;
     x:=7;y:=9;
     gotoxy(x+26,y-3); write('.::DATA RUANGAN::.');
     gotoxy(x,y-2); write(garsed2);
               gotoxy(x,y-1); writeln('|No|KODE| Jenis Ruangan  | Status Ruangan| Kapasitas |');
               gotoxy(x,y); write(garsed1);
               i:=0;
While Not EoF(Filetempat) Do
Begin
     Inc(i);
     Read(Filetempat,Data1);
     gotoxy(x,y+i); write('| ',i);
     gotoxy(x+3,y+i); write('|'); writeln(data1.kdruang);
     gotoxy(x+8,y+i); write('|'); writeln(data1.jenis);
     gotoxy(x+25,y+i); write('|');writeln(data1.status);
     gotoxy(x+41,y+i); write('|');writeln(data1.kapasitas);
     gotoxy(x+53,y+i);write('|');
End;
    Close(Filetempat);
End;
    Writeln;
    writeLN(garspas);
    Write(' Tekan Enter untuk Kembali Kemenu Utama');Readln;
End;

Procedure Pelanggan;
Var
   FileTmp : File of karaoke;
   Lagi    : Char;
   Ada     : Boolean;
   i       : Integer;
   NOCR    : string[10];
label pat,ma,nam,ju,pan,lan,luh,las,dulas,tilas,patlas,malas,namlas,julas;
Begin
     Lagi  :='Y';
     Clrscr;
     title;
Repeat
      BukaFile;
      If IOResult<>0 Then
         Write('Data Masih Kosong...!')





Ibu kota , 10 Oktober 2013

akhukum fillah arif zainurrohman

0 komentar:

Posting Komentar