Contoh Program Penjualan Tiket Bioskop
#include
#include
#include
main()
{ char kode,waktu,jawab,nama_film[20],nama_pen[10];
float harga,beli,bayar,pot,ppn,total,u_byr,u_kmb;
film:
clrscr ();
gotoxy(17,1);printf("******THeaTHeR FiLM ABC******");
gotoxy(15,4);printf("Nama Penonton : ");scanf("%s",&nama_pen);
gotoxy(15,5);printf("Kode Theater [1/2/3] : ");scanf("%s",&kode);
gotoxy(15,7);cout<<"Waktu Tayang [P/S/M] : ";cin>>waktu;
if(kode==’1′)
{ strcpy(nama_film,"Tusuk Jaelangkung");
if(waktu==’p'||waktu==’P')
harga=17500;
else if(waktu==’s'|| waktu==’S')
harga=20000;
else
harga=22500;
}
else if(kode==’2′)
{ strcpy(nama_film,"The Matrix");
if(waktu==’p'||waktu==’P')
harga=18000;
else if(waktu==’s'|| waktu==’S')
harga=20000;
else
harga=25000;
}
else
{ strcpy(nama_film,"Spiderman");
if(waktu==’p'||waktu==’P')
harga=20000;
else if(waktu==’s'|| waktu==’S')
harga=22500;
else
harga=25000;
}
gotoxy(15,6);printf("Nama Film : %s",nama_film);
gotoxy(15,8);printf("Harga Tiket : %.0f",harga);
gotoxy(15,9);printf("Jumlah Pembelian Tiket : ");scanf("%f",&beli);
gotoxy(15,10);printf("********************************");
bayar=harga*beli;
if(beli>=5)
pot=0.10*bayar;
else
pot=0;
ppn=0.5*bayar;
total=(bayar-pot)+ppn;
gotoxy(15,11);printf("Pembayaran : %.0f",bayar);
gotoxy(15,12);printf("Potongan : %.0f",pot);
gotoxy(15,13);printf("PPN : %.0f",ppn);
gotoxy(15,14);printf("Total Bayar : %.0f",total);
gotoxy(15,15);printf("********************************");
lagi:
gotoxy(15,16);printf("Uang Bayar : ");cin>>u_byr;
if (u_byr
{goto lagi;
u_byr=0 ;
printf("%d",u_byr) ;
}
else
u_kmb=u_byr-total;
gotoxy(15,17);printf("Uang Kembali : %.0f",u_kmb);
gotoxy(13,19);printf("TeRiMa KaSiH AnDa TeLaH DaTaNG Ke CouNTeR KaMi");
gotoxy(15,22);printf("Input Data Lagi [Y/T] :");jawab=getche();
if(jawab==’Y'||jawab==’y')
goto film ;
getche();
keluar:
}