Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

#include<iostream.

h>
#include<conio.h>
#include<dos.h>
int nowshowing();
int buyticket();
main(){
start:
clrscr();
char ch;
char ch2=1;
cout<<"Jaypee's Cinema"<<endl;
cout<<"[1] Now Showing"<<endl;
cout<<"[2] Buy ticket"<<endl;
cout<<"[3] Exit"<<endl;
cout<<"Enter your choice: ";cin>>ch;
if(ch=='1'){
nowshowing();
cout<<"Press ENTER to back";
getch();
goto start;
}
else if(ch=='2'){
buyticket();
clrscr();
choice2:
cout<<"Press 1 to home 0 to exit : ";cin>>ch2;
if(ch2=='1'){
goto start;
}
else if(ch2=='0'){
clrscr();
cout<<"Thank you";

}
else {
cout<<"Invalid"<<endl;
goto choice2;
}

}
else if(ch=='3'){
cout<<"Thank you";
}
else{
cout<<"Enter a number between (1-3)";
goto start;

getch();
}
int nowshowing(){
clrscr();
cout<<"[1] One Piece Stampede"<<endl;
cout<<"[2] Avengers : Endgame"<<endl;
cout<<"[3] Weathering with you"<<endl;
} //end of nowshowing function

int buyticket(){
clrscr();
int choice[10];
int ticket[10];
char yn;
cout<<"--------------------------------------"<<endl;
cout<<"[1] One Piece Stampede 250.00"<<endl;
cout<<"[2] Avengers : Endgame 200.00"<<endl;
cout<<"[3] Weathering with you 300.00"<<endl;
cout<<"--------------------------------------"<<endl;
for(int i=1;i<=5;i++){
cout<<"Enter your choice: ";cin>>choice[i];
cout<<"Number of ticket: ";cin>>ticket[i];
yn:
cout<<"Do you want to add more? [y] yes [n] no : ";cin>>yn;
if(yn=='y'){

}
else if(yn=='n'){

break;
}
else{
cout<<"Enter y or n";
goto yn;
}
} //end of for loop

int total=0;
int op=0,ave=0,wwy=0;
for(int a=1;a<=5;a++){

if(choice[a]==1){
cout<<"Movie "<<a<<": "<<"One Piece Stampede"<<endl;
cout<<"Amount: "<<(ticket[a]*250)<<endl;
op=op+(ticket[a]*250);
}
else if(choice[a]==2){
cout<<"Movie "<<a<<": "<<"Avengers : Endgame"<<endl;
cout<<"Amount: "<<(ticket[a]*200)<<endl;
ave=ave+(ticket[a]*200);
}
else if(choice[a]==3){
cout<<"Movie "<<a<<": "<<"Weathering with you"<<endl;
cout<<"Amount: "<<(ticket[a]*300)<<endl;
wwy=wwy+(ticket[a]*300);
}
total=op+ave+wwy;

} //end of for loop

char name[50];
float cash;
cout<<"Enter name: ";cin>>name;
cout<<"Total amount: "<<total<<endl;
cash:
cout<<"Enter cash: ";cin>>cash;
cout<<endl;
if(cash<total){
cout<<"Insufficient";
goto cash;
}
clrscr();
cout<<"Please wait ......";
delay(5000);
clrscr();
cout<<"Jaypee's Cinema"<<endl;
cout<<"Hello mr/ms. : "<<name<<endl;

for(int b=1;b<=5;b++){

if(choice[b]==1){
cout<<"Movie "<<b<<": "<<"One Piece Stampede"<<endl;
cout<<"Quantity: "<<ticket[b]<<endl;
cout<<"Amount: "<<(ticket[b]*250)<<endl;
}
else if(choice[b]==2){
cout<<"Movie "<<b<<": "<<"Avengers : Endgame"<<endl;
cout<<"Quantity: "<<ticket[b]<<endl;
cout<<"Amount: "<<(ticket[b]*200)<<endl;
}
else if(choice[b]==3){
cout<<"Movie "<<b<<": "<<"Weathering with you"<<endl;
cout<<"Quantity: "<<ticket[b]<<endl;
cout<<"Amount: "<<(ticket[b]*300)<<endl;
}
} //end of for loop
cout<<"Total Amount: "<<total<<endl;
cout<<"Cash: "<<cash<<endl;
cout<<"Change: "<<cash-total<<endl;
cout<<"\n\n\n\n\n\n Press Enter";
getch();

You might also like