1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
main()
{
/* noft: number of tickets , nofi: number of items (other than the tickets)
sumt: sum of noft , sumpt: sum of price of ticket , sumi : sum of nofi(popcorn,juice,water)
sum: sum of price of everything ,n_p: number of popcorn , p_p: price of popcorn , etc...*/
int n_t=1,n_i;
char name,response1,yes,no,choice,A,B,C;
int n_p,p_p=0,n_j,p_j=0,n_w,p_w=0,sumpt=0,sumi=0,sum=0;
const int pticket=20,ppopcorn=10,pjuice=10,pwater=3;
cout<<" Welcome to the Cinema ";
cout<<"\n Please Enter your Name :";
cin>>name;
cout<<"\n Please Enter the number of tickets you would like"<<endl;
cin>>n_t;
sumpt=sumpt+pticket*n_t;
cout<<"\n Price of tickets ="<<sumpt<<"SR";
cout<<"\n Would you like any other item ?";
cout<<"\n Enter yes or no"<<endl;
cin>>yes>>no;
if (yes)
{ cout<<"\n Choose from the following items : \n A-Popcorn \n B-Juice \n C-Water"<<endl;
switch (choice)
{
case'A':cout<<"\n How many Popcorn buckets would you like"<<endl;
cin>>n_p;
{
(p_p=p_p+ppopcorn*n_p);
cout<<"\n Price of Popcorn ="<<p_p<<"SR";
}
break;
case'B':cout<<"\n How many juice bottles would you like ?"<<endl;
cin>>n_j;
{
(p_j=p_j+pjuice*n_j);
cout<<"\n Price of Juice ="<<p_j<<"SR";
}
break;
case'C':cout<<"\n How many water bottles would you like ?"<<endl;
cin>>n_w;
{
(p_w=p_w+pwater*n_w);
cout<<"\n Price of Water ="<<p_w<<"SR";
}
break;
cout<<"\n Thank you for choosing our cinema ";
(sumi=sumi+p_p+p_j+p_w);
(sum=sum+sumi+sumpt);
cout<<"\n Total Price of Items = "<<sumi<<"SR";
cout<<"\n Total Price of Items Including Tickets ="<<sum<<"SR";
}
}
else if (no)
{
cout<<"\n Thank you for choosing our cinema";
cout<<"\n Total Price of Tickets ="<<sumpt<<"SR";
}
getch();
}
| |