uses wincrt;
type barang =record
code,nama:string;
harga:real;
satuan:string;
stok:byte;
end;
larikbar=array[1..20] of barang;
var bar:larikbar;
i,n,x:byte;
lagi:char;
begin
lagi:='y';
while lagi='y' do
begin
inc(n);
writeln('mengisi data barang ke ', n);
write('kode barang ==>');readln(bar[n].code);
write('nama barang ==>');readln(bar[n].nama);
write('harga ==>');readln(bar[n].harga);
write('satuan ==>');readln(bar[n].satuan);
writeln;write('mau masukan data barang lain
end;
{transaksi}
writeln('mengisi stok');
for i:=1 to n do
begin
write('membeli', bar[i].nama, ' sebanyak? ');
readln(x); bar [i].stok:=x;
end;
{setak}
writeln;
writeln;
writeln(' DAFTAR STOK TOKO BAGUS ');
writeln('========================================================');
writeln(' no kode nama barang harga satuan stok ');
writeln('--------------------------------------------------------');
for i:=1 to n do with bar[i] do
writeln(i:2,code:6,nama:15,harga:12:2,satuan:8,stok:8);
writeln('---------------------------------------------------------');
{jual}
end.
Tugas Mandiri 2
03.00 |
Label:
Tugas Pemrograman Dasar
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar