Sabtu, 02 Juli 2011

Contoh Program Penjualan


USES CRT;
TYPE PRODUK=RECORD
     KODE  :STRING[3];
     NAMA  :STRING[30];
     HARGA :LONGINT;
     END;
VAR
   FPRO    :FILE OF PRODUK;
   RPRO    :PRODUK;
   LG      :CHAR;
   i       :BYTE;

PROCEDURE OPENPRODUK;
BEGIN
     ASSIGN(FPRO,'C:\PRODUK.DAT');
     {$I-}RESET(FPRO);
     {$I+}IF IORESULT<>0 THEN REWRITE(FPRO);
END;
BEGIN
     OPENPRODUK;
     CLRSCR;
     REPEAT
           GOTOXY(20,5);WRITE('INPUT DATA PRODUK');
           GOTOXY(20,6);WRITE('-------------------------');
           GOTOXY(20,7);WRITE('KODE  :');READLN(RPRO.KODE);
           GOTOXY(20,8);WRITE('NAMA  :');READLN(RPRO.NAMA);
           GOTOXY(20,9);WRITE('HARGA :');READLN(RPRO.HARGA);
        SEEK(FPRO,FILESIZE(FPRO));
        WRITE(FPRO,RPRO);
        GOTOXY(20,11);WRITE('INPUT LAGI[Y/T]:');
        READLN(LG);
     UNTIL UPCASE(LG)='T';
     CLOSE(FPRO);
END.

Tidak ada komentar:

Posting Komentar