Berikut ini merupakan program outputnya
Listing programnya
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 ;
i :=1 ;
clrscr ;
Gotoxy(20, 4) ; Write('Informasi PRODUK') ;
Gotoxy(20, 5) ; Write('-------------------------------------') ;
Gotoxy(20, 6) ; Write(' No Kode Nama Harga ') ;
Gotoxy(20, 7) ; Write('-------------------------------------') ;
seek(fpro, 0) ;
while not eof(fpro) do
begin
seek(fpro, i-1) ;
read(fpro, rpro) ;
Gotoxy(22, 7+i) ; Write( i ) ;
Gotoxy(25, 7+i) ; Write( rpro.Kode ) ;
Gotoxy(32, 7+i) ; Write( rpro.Nama) ;
Gotoxy(45, 7+i) ; Write( rpro.Harga:9) ;
inc (i) ;
end;
Gotoxy(20, 7+i) ; Write('-------------------------------------') ;
Gotoxy(20, 8+i) ; Write('press any key to continue...') ;
Close(fPro) ;
Repeat Until Keypressed;
end.
Hasil outputnya yaitu :

Tidak ada komentar:
Posting Komentar