Inputnya:
Program Belanja;
uses wincrt;
uses wincrt;
var
harga,jumlah:real;
ulang:char;
pilih:integer;
procedure judul;
begin
writeln(' PROGRAM MENGHITUNG HARGA BARANG');
write('===================================');
end;
procedure menu_pilihan;
begin
writeln(' HARGA BARANG PERUNIT');
writeln(' 1.Laptop Rp.5.600.000');
writeln(' 2.Notebook Rp.2.300.000');
writeln(' 3.Pc/komputer Rp.4.500.000');
writeln('==================================');
end;
procedure laptop;
begin
write('Jumlah Barang Dibeli :');
readln(jumlah);
writeln('Total harga :',jumlah*5600000:3:0);
end;
procedure notebook;
begin
write('Jumlah Barang Dibeli :');
readln(jumlah);
writeln('Total harga :',jumlah*2300000:3:0);
end;
procedure pc;
begin
write('Jumlah Barang Dibeli :');
readln(jumlah);
writeln('Total harga :',jumlah*4500000:3:0);
end;
begin
ulang:='y';
while (ulang='y') or(ulang='Y')do
begin
clrscr;
judul;writeln;
menu_pilihan;writeln;
write('Barang yang akan dipilih :');readln(pilih);
case pilih of
1:laptop;
2:notebook;
3:pc;
end;writeln;
write('apakah anda ingin membeli lagi (y/t?) :');readln(ulang);
end;
readln;donewincrt;
end.