Translate

Jumat, 03 Mei 2013

Tugas Pascal Menggunakan With


program Program_Barang;
uses crt:
type
brg=record
kd:string[5];
nama:string[10];
quantity:real;
harga:real;
tot :real;
end;
var
   barang:array[1..50] of brg;
   d,e,f:integer:
   total:real:
begin
total := 0:
clrscr;
write('Mau Input Berapa Data ?= '); readln(d);
for e := 1 to a do
    begin
    with barang[e] do
         begin
             write('Kode Barang = '); readln(kd);
             write('Nama Barang = '); readln(nama);
             write('Quantity = ');  readln(quantity);
             write(Harga Satuan = '): readln(harga):
             tot := quantity * harga;
             total := total + tot;
             writeln;
         end;
    end;

writeln('Kode Barang      Nama Barang     Quantity     Harga Satuan    Total Harga');
for f := 1 to a do
begin
   with barang[f] do
   writeln(kd:17 , nama:5, quantity:25:0, harga:15:0, tot:0);
end;
writeln('Total Harga = ', total;10:0):
readln;
end.

JANGAN LUPA FOLLOW BLOG ANE sebagai imbalannya :p

0 komentar:

Posting Komentar