CONTOH PROGRAM SEDERHANA MENU PADA PASCAL MENGGUNAKAN ARRAY MULTIDIMENSI.
uses crt;
label ulang;
var
pilih : integer;
jenis,a,b,c,o,total,total1,total2,tot :longint;
z,ret,ret2 :string;
i: array[1..3,1..2] of integer;
Begin
ulang:
clrscr;
i[1,1]:=15000;i[1,2]:=22000;
i[2,1]:=18000;i[2,2]:=25000;
i[3,1]:=17500;i[3,2]:=25500;
writeln ('_____________Kantin Gunadarma______________');
writeln ('No.|Menu |Harga MHS |Harga Karyawan|');
writeln ('1. |Soto Ayam |',i[1,1],' |',i[1,2],' |');
writeln ('2. |Soto Daging|',i[2,1],' |',i[2,2],' |');
writeln ('3. |Soto Babat |',i[3,1],' |',i[3,2],' |');
write;
write ('Pilihan Harga [1(MHS)/2(KRYWN)] : '); readln(pilih);
if pilih = 1 then
begin
write ('No. menu : '); readln(c);
write ('Jumlah Pesan : ');readln(a);
writeln ('Harga Satuan : ', i[c,pilih]);
total:=i[c,1]*a;
writeln ('Total : ',total);
writeln ('Tambah Lagi Y/N : '); readln(z);
if z = 'Y' then
begin
write ('No. menu : '); readln(o);
write ('Jumlah Pesan : ');readln(a);
writeln ('Harga Satuan : ', i[c,pilih]);
total1:=i[o,1]*a+total;
writeln ('Total : ',total1);
writeln ('Mau ulang Y/N : '); readln(ret);
if ret = 'Y' then
begin
goto ulang;
end
else if ret = 'N' then
begin
end
end
else
begin
end
end
else if pilih = 2 then
begin
write ('No. menu : '); readln(c);
write ('Jumlah Pesan : ');readln(a);
writeln ('Harga Satuan : ', i[c,pilih]);
total2:=i[c,2]*a;
writeln ('Total : ',total2);
writeln ('Tambah Lagi Y/N : '); readln(z);
if z = 'Y' then
begin
write ('No. menu : '); readln(o);
write ('Jumlah Pesan : ');readln(a);
writeln ('Harga Satuan : ', i[o,pilih]);
tot:=i[o,2]*a;
writeln ('Total : ',tot);
total1:=tot+total2;
writeln ('Total semuanya : ',total1);
writeln ('Mau ulang Y/N : '); readln(ret2);
if ret2 = 'Y' then
begin
goto ulang;
end
else if ret2 = 'N' then
begin
end
end
else
begin
end
end
end.
SEMOGA BERMANFAAT gan.
ADS HERE !!!