forked from DHEERAJHARODE/Hacktoberfest2024-Open-source-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovie Ticket Booking System Using C++.cpp
509 lines (493 loc) · 12.7 KB
/
Movie Ticket Booking System Using C++.cpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
//Movie ticket booking program
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include <time.h>
using namespace std;
class ticket{
public:
char name[20];
char cno[11];
} t;
class card : public ticket{
public:
char address[50];
char emailid[20];
} v;
void pay(int);
void random();
void card();
int main(){
system("CLS");
int ent, a, b, N, x, cardid;
char ans;
do{
cout<<"\n\t\t----------------------------------";
cout<<"\n\t\t Movie Ticket Booking System";
cout<<"\n\t\t----------------------------------";
cout<<"\n\t\t\tWelcome Customer!";
cout<<"\n\n\t\t\t<1> Movie Timings";
cout<<"\n\t\t\t<2> Recieving Ticket";
cout<<"\n\t\t\t<3> Contact Us";
cout<<"\n\t\t\t<4> DTCard Registration";
cout<<"\n\t\t\t<5> Exit \n\n";
cout<<"\t\t\tEnter Your Choice :"<<"\t";
cin>>ent;
switch(ent)
{
case 1:
system("CLS");
cout<<"\n\n\t\t\tThe Shows are :";
cout<<"\n\n\t\t\t1. Avengers: Endgame";
cout<<"\n\n\t\t\t2. Super Girl";
cout<<"\n\n\t\t\t3. Deadpool 3";
cout<<"\n\n\t\t\t4. Free Guy";
cout<<"\n\n\t\t\t5. Ready or Not\n";
cout<<"\n\t\t\tEnter Your Choice :"<<"\t";
cin>>a;
cout<<"\n\n\t\t\tThe Timings for the selected show are:";
switch(a)
{
case 1:
system("CLS");
cout<<"\n\n\t\t\tSelect the the timings: ";
cout<<"\n\t\t\t1. 0800";
cout<<"\n\t\t\t2. 1300";
cout<<"\n\t\t\t3. 1450";
cout<<"\n\t\t\t4. 1800";
cout<<"\n\t\t\t5. 2100";
cout<<"\n\t\t\t6. 0100 \n";
cout<<"\n\n\t\tPlease select the timings: ";
cin>>b;
cout<<"\n\n\t\tEnter your name: ";
cin>>t.name;
cout<<"\n\n\t\tEnter your contact number: ";
cin>>t.cno;
cout<<"\n\n\t\tEnter the number of tickets you want to purchase: ";
int x;
cin>>x;
pay(x);
cout<<"\n\n\n\t\t\tYour ticket is here: ";
cout<<"\n\t\t\tName :"<<t.name;
cout<<"\n\t\t\tContact No :"<<t.cno;
cout<<"\n\t\t\tShow timings :";
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;
}
cout<<"\n\n\t\t\tDo you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 2:
system("CLS");
cout<<"\n\n\t\t\tSelect the the timings:";
cout<<"\n\t\t\t1. 0900";
cout<<"\n\t\t\t2. 1100";
cout<<"\n\t\t\t3. 1250";
cout<<"\n\t\t\t4. 1500";
cout<<"\n\t\t\t5. 2000";
cout<<"\n\t\t\t6. 2200";
cout<<"\n\t\t\tPlease select the timings: ";
cin>>b;
cout<<"\n\n\t\t\tEnter your name: ";
cin>>t.name;
cout<<"\n\t\t\tEnter your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\tEnter the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n\n\t\t\tYour ticket is here:";
cout<<"\n\t\t\tName :"<<t.name;
cout<<"\n\t\t\tContact No :"<<t.cno;
cout<<"\n\t\t\tShow timings :";
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;
}
cout<<"\n\n\t\t\tDo you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 3:
system("CLS");
cout<<"\n\n\t\t\tSelect the the timings:";
cout<<"\n\t\t\t1. 0800";
cout<<"\n\t\t\t2. 1300";
cout<<"\n\t\t\t3. 1450";
cout<<"\n\t\t\t4. 1800";
cout<<"\n\t\t\t5. 2100";
cout<<"\n\t\t\t6. 0100";
cout<<"\n\t\t\tPlease select the timings";
cin>>b;
cout<<"\n\t\t\tEnter your name: ";
cin>>t.name;
cout<<"\n\t\t\tEnter your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\tEnter the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n\n\t\t\tYour ticket is here: ";
cout<<"\n\t\t\tName :"<<t.name;
cout<<"\n\t\t\tContact No :"<<t.cno;
cout<<"\n\t\t\tShow timings :";
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;
}
cout<<"\n\n\t\t\tDo you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 4:
system("CLS");
cout<<"\n\n\t\t\tSelect the the timings: ";
cout<<"\n\t\t\t1. 0800";
cout<<"\n\t\t\t2. 1300";
cout<<"\n\t\t\t3. 1450";
cout<<"\n\t\t\t4. 1800";
cout<<"\n\t\t\t5. 2100";
cout<<"\n\t\t\t6. 0100";
cout<<"\n\t\t\tPlease select the timings: ";
cin>>b;
cout<<"\n\t\t\tEnter your name: ";
cin>>t.name;
cout<<"\n\t\t\tEnter your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\tEnter the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n\n\t\t\tYour ticket is here: ";
cout<<"\n\t\t\tName :"<<t.name;
cout<<"\n\t\t\tContact No :"<<t.cno;
cout<<"\n\t\t\tShow timings :";
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;
}
cout<<"\n\n\t\t\tDo you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 5:
system("CLS");
cout<<"\n\n\t\t\tSelect the the timings:";
cout<<"\n\t\t\t1. 0800";
cout<<"\n\t\t\t2. 1300";
cout<<"\n\t\t\t3. 1450";
cout<<"\n\t\t\t4. 1800";
cout<<"\n\t\t\t5. 2100";
cout<<"\n\t\t\t6. 0100";
cout<<"\n\t\t\tPlease select the timings: ";
cin>>b;
cout<<"\n\t\t\tEnter your name: ";
cin>>t.name;
cout<<"\n\t\t\tEnter your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\tEnter the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n \n\t\t\tYour ticket is here: ";
cout<<"\n\t\t\tName :"<<t.name;
cout<<"\n\t\t\tContact No :"<<t.cno;
cout<<"\n\t\t\tShow timings :";
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;
}
cout<<"\n\n\t\t\tDo you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
}break;
case 2: system("CLS");
cout<<"\n\nThank you for booking the tickets online \nTo print out the tickets please enter your Name in the portal.";
struct pre
{
char name[10];
} p;
cout <<"\nEnter your name:";
cin>>p.name;
cout<<"\nWe're sorry to say, but you will need to get the print out of the booking in front of our cinema.\nThe system did't have a printable function yet.";
cout<<"\n Do you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 3: system("CLS");
cout<<"\n Do you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 4: system("CLS");
cout<<"Good Morning/Evening Mam/Sir\n Welcome to our cinemas \n";
card();
cout<<"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;
cout<<"\n For selecting the page to go to benefits say (y/n)\n";
cin>>f;
if(f=='y')
{
cout<<"Thank you for registeration once again \n The priveleges provided with this card are as follows:";
cout<<"\n 1. For every purchase of a movie ticket you get 25 points(1point = 1$.) so after 16 movies you get a free movie ticket.";
cout<<"\n 2. You are provided with regular updates regarding the movie and the showtimings.";
cout<<"\n 3. Anytime prebook tickets for the upcoming movie and preffered seats will be provided.";
}
cout<<"\n Do you want to choose another option(y/n)";
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;
cout<<"\nWelcome:\nYou can register a card for facility in our cinemas";
cout<<" \nEnter your name: ";
cin>>v.name;
cout<<"Enter your mobile number: ";
cin>>v.cno;
system("CLS");
int ID;
srand (time(NULL));
ID = rand() % 400000 + 4000000;
if (ID<0)
ID=(ID*-1);
cout<<"Your new card number is - :" <<"\t"<<ID;
fstream fout;
fout.open("card.dat", ios::out|ios::app);
fout<<"\n Name :"<<v.name<<"\n"<<"\n Mobile No. :"<<v.cno<<"\n"<<"\nCard Number:"<<ID;
fout.close();
cout<<"\nThank you for the registeration for the card. \n";
}
void pay(int a)
{
int normal, gold, amt[2],id;
time_t t = time(NULL);
tm* timePtr = localtime(&t);
fstream fin;
fin.open("card.dat", 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)
{
cout<<"\n\n\t\t\tYou selected for a Normal show \n\n\t\t\t\t";
system("PAUSE");
system("CLS");
amt[1] = a * 400;
char final;
cout<<"\n\n\t\t\tDo you have DTcard(y/n): ";
cin>>final;
if(final=='y')
{
int cid;
fin.read((char*) &v, sizeof(v));
cout<<"\n\t\t\tEnter the card number[10 digits]: ";
if(cid==id)
{
amt[1]=amt[1] - (0.1*amt[1]);
};
}
cout<<"\n\t\t\tWant to pay by Card(y/n): ";
char rep;
cin>>rep;
cout<<"\n\t\t\t"<<"Paying :"<<amt[1]<<"\n";
if (rep=='y'||rep=='Y')
{
cout<<"\t\t\tName of the card holder: ";
char n[10];
gets(n);
cout<<"\n\t\t\tEnter the card number: ";
char Card[16];
gets(Card);
cout<<"\t\t\t\tExpiry(MM/YYYY)";
int expirymm,expiryyy;
cin>>expirymm;
cout<<"\t\t\t\t/";
cin>>expiryyy;
while(expirymm<(timePtr->tm_mon) || expiryyy<(timePtr->tm_year + 1900)){
if(expirymm<=(timePtr->tm_mon))
{
cout<<"\t\t\t\tEnter the month again: ";
cin>>expirymm;
}
if(expiryyy<(timePtr->tm_year + 1900))
{
cout<<"\t\t\t\tPlease enter a valid year: ";
cin>>expiryyy;
}
};
char password[3],vh;
int h;
puts("\t\t\t\tEnter the CVV/CVV2: ");
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
{
cout<<"\n\n\t\t\tYou selected for the Gold Class \n\t\t\t\t";
system("PAUSE");
system("CLS");
amt[2] = a * 700;
char final;
cout<<"\n\t\t\tDo you have DTcard(y/n): ";
cin>>final;
if(final=='y')
{
int cid;
cout<<"\n\t\t\tEnter the card id number: ";
cin>>cid;
if(cid==id)
{
amt[1]=amt[1] - (0.1*amt[1]);
};
}
cout<<"\n\t\t\tWant to pay by Card(y/n): ";
char rep;
cin>>rep;
cout<<"\n\t\t\t"<<"Paying :"<<amt[2]<<"\n";
if (rep=='y'||rep=='Y')
{
cout<<"\t\t\tName of the card holder: ";
char n[10];
gets(n);
cout<<"\n\t\t\tEnter the card number: ";
char Card[16];
gets(Card);
cout<<"\n\t\t\tExpiry(MM/YY): ";
int expirymm, expiryyy;
cin>>expirymm;
cout<<"\n/";
cin>>expiryyy;
while(expirymm<(timePtr->tm_mon) || expiryyy<(timePtr->tm_year + 1900)){
if(expirymm<=(timePtr->tm_mon))
{
cout<<"\n\t\t\tEnter the month again: ";
cin>>expirymm;
}
if(expiryyy<(timePtr->tm_year + 1900))
{
cout<<"\n\t\t\tPlease enter a valid year: ";
cin>>expiryyy;
}
};
char password[3],vh;
int h;
puts("\n\t\t\tEnter the CVV/CVV2: ");
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';
}
};
}