pertama-tama kita buka pemrograman pascal
setelah itu tulislah program di bawah ini:
program nota_pembelian;
uses crt;
type
databrg = record
nama_brg : string[10];
harga_brg : real;
kode : string[4];
jml : integer;
total : real;
end;
var
jumlahbrg,i,j : byte;
totalharga : real;
nama : string;
barang : array[1..80] of databrg;
begin
clrscr;
write('Nama Pembeli:');readln(Nama);
write('Jumlah Pembelian:');readln(Jumlahbrg);
for i := 1 to Jumlahbrg do
begin
writeln;writeln('barang ke',i:2);
with barang[i] do
begin
write('Nama_brg:');readln(nama_brg);
write('Harga_Satuan:');readln(harga_brg);
write('Jumlah:');readln(jml);
end;
end;
clrscr;
writeln('Nota Pembelian');
writeln;
writeln('Nama Pembeli:',Nama);
textbackground(blue);
writeln('========================================================');
writeln(' No | Namabarang | Hargasatuan | Jumlah | Total ');
writeln('========================================================');
textbackground(black);
totalharga:=0;
for i := 1 to Jumlahbrg do
begin
with barang[i] do
begin
totalharga := totalharga+(harga_brg*jml);
total := harga_brg*jml;
write(i, ' |');
write(nama_brg,' |');
write(harga_brg:10:2,' |');
write(jml,' |');
writeln(total:10:2);
end;
end;
writeln('======================================================');
writeln('jumlah total :',totalharga: 10:2);
writeln('');
readln;
end.
hasilnya seperti di bawah ini
dan setelah di enter akan keluar seperti
selamat mencoba
semoga sukses
1 komentar:
Wah nebisa membantu kinerja saya di toko...
hemmmmm Terima kasih ya chayank's
Posting Komentar