Updated Source Codes For Movie Ticket Booking
Updated Source Codes For Movie Ticket Booking
Updated Source Codes For Movie Ticket Booking
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include <time.h>
class ticket{
public:
char name[10];
char cno[10];
public:
char address[50];
char emailid[20];
void random();
void card();
//Main function
int main(){
system("CLS");
//Integer Declaration
char ans;
{time_t t = time(NULL);
//Menu
cout<<"\n\t\t\t ----------------------------------";
cout<<"\n\t\t\t ----------------------------------";
cin>>ent;
switch(ent)
//Movie Titles
case 1:
system("CLS");
cout<<"\n\n\t\t\t\t 3. Shazam";
cin>>a;
cout<<"\n\n\t\t\t\t The Timings for the selected show are:";
switch(a)
case 1:
system("CLS");
cout<<"\n\t\t\t\t 1. 0800";
cout<<"\n\t\t\t\t 2. 1300";
cout<<"\n\t\t\t\t 3. 1450";
cout<<"\n\t\t\t\t 4. 1800";
cout<<"\n\t\t\t\t 5. 2100";
cin>>b;
cin>>t.name;
cin>>t.cno;
int x;
cin>>x;
pay(x);
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
cin>>ans;
system("CLS");
break;
case 2:
system("CLS");
cout<<"\n\t\t\t\t 1. 0900";
cout<<"\n\t\t\t\t 2. 1100";
cout<<"\n\t\t\t\t 3. 1250";
cout<<"\n\t\t\t\t 4. 1500";
cout<<"\n\t\t\t\t 5. 2000";
cout<<"\n\t\t\t\t 6. 2200";
cin>>b;
cin>>t.name;
cin>>t.cno;
cin>>x;
pay(x);
switch(b)
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
cin>>ans;
system("CLS");
break;
case 3:
system("CLS");
cout<<"\n\t\t\t\t 1. 0800";
cout<<"\n\t\t\t\t 2. 1300";
cout<<"\n\t\t\t\t 3. 1450";
cout<<"\n\t\t\t\t 4. 1800";
cout<<"\n\t\t\t\t 5. 2100";
cout<<"\n\t\t\t\t 6. 0100";
cin>>b;
cin>>t.name;
cin>>t.cno;
cin>>x;
pay(x);
switch(b)
case 1: cout<<"0900";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
cin>>ans;
system("CLS");
break;
case 4:
system("CLS");
cout<<"\n\t\t\t\t 1. 0800";
cout<<"\n\t\t\t\t 2. 1300";
cout<<"\n\t\t\t\t 3. 1450";
cout<<"\n\t\t\t\t 4. 1800";
cout<<"\n\t\t\t\t 5. 2100";
cout<<"\n\t\t\t\t 6. 0100";
cin>>b;
cin>>t.name;
cin>>t.cno;
cin>>x;
pay(x);
switch(b)
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
cin>>ans;
system("CLS");
break;
case 5:
system("CLS");
cout<<"\n\t\t\t\t 1. 0800";
cout<<"\n\t\t\t\t 2. 1300";
cout<<"\n\t\t\t\t 3. 1450";
cout<<"\n\t\t\t\t 4. 1800";
cout<<"\n\t\t\t\t 5. 2100";
cout<<"\n\t\t\t\t 6. 0100";
cin>>b;
cin>>t.name;
cin>>t.cno;
cin>>x;
pay(x);
cout<<"\n \n\t\t\t\t Your ticket is here: ";
switch(b)
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
cin>>ans;
system("CLS");
break;
}break;
case 2: system("CLS");
int trsnid;
char name[10];
} p;
cin>>p.trsnid;
cin>>p.name;
cout<<"Sorry to say that but you will need to get the print out of the
booking because our database shows no booking by this name";
cin>>ans;
system("CLS");
break;
case 3: system("CLS");
cin>>ans;
system("CLS");
break;
case 4: system("CLS");
//card membership
card();
cout<<"Thank you. \n It will take us a week for completing your
registration for the card. \n Please see the benefits of the card on the next page. -->";
char f;
cin>>f;
if(f=='y')
cin>>ans;
if(ans=='y')
system("CLS");
break;
else
exit(0);
break;
case 5:
system("CLS");
system("PAUSE");
exit(0);
break;
}while(ans=='y');
void card()
int cardid;
cin>>v.name;
cin>>v.cno;
gets(v.address);
gets(v.emailid);
system("CLS");
int ID;
srand (time(NULL));
if (ID<0)
ID=(ID*-1);
fstream fout;
fout.open("card.dat", ios::out|ios::app);
fout.close();
void pay(int a)
fstream fin;
fin.open("card.txt", ios::in|ios::app);
fin>>id;
cout<<"\t\tThank you for selecting the show. Now we request you to select your type of
seating \n\n\t\t\t\t 1.Normal Class \n\t\t\t\t OR \n\t\t\t\t 2. Gold Class";
int c;
cin>>c;
if(c==1)
system("PAUSE");
system("CLS");
amt[1] = a * 400;
char final;
cin>>final;
if(final=='y')
int cid;
if(cid==id)
amt[1]=amt[1] - (0.1*amt[1]);
};
char rep;
cin>>rep;
cout<<"\n\t\t\t\t"<<"Paying :"<<amt[1]<<"\n";
if (rep=='y'||rep=='Y')
char n[10];
gets(n);
char Card[16];
gets(Card);
cout<<"\t\t\t\tExpiry(YYYY)";
int expiryyyy;
cin>>expiryyyy;
while(expiryyyy<(timePtr->tm_year + 1900)){
if(expiryyyy<(timePtr->tm_year + 1900))
cin>>expiryyyy;
char password[3],vh;
int h;
while (1)
if (h<0)
h=0;
vh=getch();
if (vh==13)
break;
if (vh==8)
putch(NULL);
putch(NULL);
putch(NULL);
h--;
continue;
password[h++]=vh;
vh='*';
putch(vh);
};
password[h]=='\0';
else
system("PAUSE");
system("CLS");
amt[2] = a * 700;
char final;
cin>>final;
if(final=='y')
int cid;
cin>>cid;
if(cid==id)
amt[1]=amt[1] - (0.1*amt[1]);
};
char rep;
cin>>rep;
cout<<"\n\t\t\t\t"<<"Paying :"<<amt[2]<<"\n";
if (rep=='y'||rep=='Y')
char n[10];
gets(n);
char Card[16];
gets(Card);
cout<<"\n\t\t\t\tExpiry(MM/YY): ";
cin>>expirymm;
cout<<"\n/";
cin>>expiryyy;
while(expirymm<(timePtr->tm_mon) || expiryyy<(timePtr->tm_year +
1900)){
if(expirymm<=(timePtr->tm_mon))
cin>>expirymm;
if(expiryyy<(timePtr->tm_year + 1900))
{
cout<<"\n\t\t\t\tPlease enter a valid year: ";
cin>>expiryyy;
};
char password[3],vh;
int h;
while (1)
if (h<0)
h=0;
vh=getch();
if (vh==13)
break;
if (vh==8)
putch(NULL);
putch(NULL);
putch(NULL);
h--;
continue;
password[h++]=vh;
vh='*';
putch(vh);
};
password[h]=='\0';
}
};