Program barang
program pertamaku;
type
databrg=record
namabrg:string[15];
unitbrg:array[1..13] of byte;
end;
var
jumlahbrg,i,j:byte;
totalunit,total1,total2,total3,totaltotal:word;
barang:array [1..50] of databrg;
begin
write('Jumlah barang');readln(jumlahbrg);
for i:=1 to jumlahbrg do
begin
writeln;
writeln('Barang ke',i:2);
with barang[i] do
begin
write('Nama barang=');readln(namabrg);
for j:=1 to 3 do
begin
write('Unit ukuran',j:2,'?');readln(unitbrg[j]);
end;
end;
end;
writeln;
writeln;
writeln('-----------------------------------------------------');
writeln(' unit');
writeln('-----------------------------------------------------');
writeln('Nama barang ukuran 1 ukuran 2 ukuran 3 total');
writeln('( kecil) (sedang) (besar) unit');
writeln('-----------------------------------------------------');
total1:=0;total2:=0;total3:=0;totaltotal:=0;
for i:=1 to jumlahbrg do
begin
with barang[i] do
begin
totalunit:=unitbrg[1]+unitbrg[2]+unitbrg[3];
total1:=total1+unitbrg[1];
total2:=total2+unitbrg[2];
total3:=total3+unitbrg[3];
totaltotal:=totaltotal+totalunit;
write(namabrg:15);
writeln(unitbrg[1]:7,unitbrg[2]:10,unitbrg[3]:10,totalunit:10);
end;
writeln;
writeln('***total ',total1:13,total2:13,total3:13);
readln;
end;
end.
0 komentar:
Posting Komentar