program data_penjualan_barang;
uses wincrt;
const Nmaks=100;
type
barang=record
kode:string[10];
nama:string[35];
banyak:integer;
harga:integer;
total:integer;
end;
type nilai=array[1..Nmaks]
of barang;
var
M:nilai;
N:integer;
{banyaknya barang}
i:integer; {indeks
larik}
total:real;
begin
clrscr;
{inisialisasi
larik}
for i:=1 to Nmaks
do
begin
M[i].kode:=' ';
M[i].nama:=' ';
M[i].banyak:=0;
M[i].harga:=0;
M[i].total:=0;
end;
write('Banyaknya
Barang : '); readln(N);
for i:=1 to N do
begin
writeln('Barang Ke-',i,' dari ',N);
write('Kode
Barang : '); readln(M[i].kode);
write('Nama
Barang : '); readln(M[i].nama);
write('Banyak Barang : '); readln(M[i].banyak);
write('Harga
Satuan : '); readln(M[i].harga);
M[i].total:=M[i].harga*M[i].banyak;
total:=total+M[i].total;
writeln('total
: ',M[i].total);
end;
{cetak isi
larik}
clrscr;
writeln(' DATA PENJUALAN BARANG ');
writeln('==================================================================');
writeln('No | KodeBarang | NamaBarang | BanyakBarang |
HargaSatuan | Total |');
writeln('==================================================================');
for i:=1 to N do
begin
writeln (
i,' ',M[i].kode,' ',M[i].nama,' ',M[i].banyak,' ',M[i].harga,' ',M[i].total);
end;
writeln('==================================================================');
writeln('Total
Pembayaran: Rp',total:3:2);
readln;
end.
0 50 Kometar:
Posting Komentar