-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
781 lines (778 loc) · 17.6 KB
/
main.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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
// CRUISE TRAVEL MANAGENMENT
/*A Project based on Cruise Travel Management */
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
#include<ctype.h>
#include<stdlib.h>
#include<iomanip.h>
long int code;
class persdetails //class for collecting the personal details
{
int trvlcode;
int age[20];
char name[20][20];
char add[50];
char phnum[15];
char sex[20];
char passnum[10][10];
char familyname[30];
int num;
int numppl;
public:
void p_input(int);
void p_output();
void givefam();
int givecode();
int give();
}pob;
int persdetails::give()
{
return num;
}
void persdetails::givefam()
{
cout<<familyname;
}
int persdetails::givecode()
{
return trvlcode;
}
void persdetails::p_input(int cd) //input func() of class1
{
trvlcode=cd;
num=0;
clrscr();
cout<<"\n\n\t:::::::::::::::::::::: PERSONAL DETAILS ::::::::::::::::::::::\n";
cout<<"\t\t\t\t\n";
cout<<"\n\t\t Please fill in the details:\n\n\n\t\t\t1.Family Name: ";
gets(familyname);
cout<<"\n\t\t\t2.Address: ";
gets(add);
cout<<"\n\t\t\t3.Contact Number(10 Digit Mobile Number) : ";
gets(phnum);
cout<<"\n\n\n\t\tEnter The No of People Travelling: ";
cin>>numppl;
clrscr();
if(numppl>0)
{
cout<<"\n\t\tPlease Enter The Details of each Member/Members: "<<endl;
cout<<"\t\t\n";
for(int i=0;i<numppl;i++)
{
cout<<endl<<"\n\t\tMember "<<i+1;
cout<<"\n\t\t";
cout<<"\n\n\t\tFirst Name: ";
gets(name[i]);
cout<<"\n\t\tAge: ";
cin>>age[i];
cout<<"\n\t\tSex (M/F):";
cin>>sex[i];
cout<<"\n\t\tPassport Number: ";
gets(passnum[i]);
if(age[i]>5)
{
num++; //to calculate no of travellers below 5 yrs
}
}
}
}
void persdetails::p_output() //output func() of class1
{
clrscr();
cout<<"\n\n\t PERSONAL DETAILS "<<endl;
cout<<"\n\n\t\t\tFamily Name:\t "<<familyname<<endl;
cout<<"\t\t\tAddress:\t "<<add<<endl;
cout<<"\t\t\tPhone Number:\t "<<phnum<<endl;
cout<<"\n\n\tName\t\tAge\t\tSex\t\tPassport Number\n"<<endl;
for(int i=0;i<numppl;i++)
{
cout<<"\t"<<name[i]<<"\t\t"<<age[i]<<"\t\t"<<sex[i]<<"\t\t"<<passnum[i]<<endl;
}
getch();
}
class travdetails //class which holds the travel details
{
int trvtcode;
int day;
int month;
int year;
int num1;
int bdg_pt;
int go_pt;
int deck;
int cabin;
int pool;
int gym;
int sports;
int salon;
int spa;
int theatre;
public:
void initial();
void t_input(int);
void t_output();
void compute();
int gtcode();
void accept(int);
}tob;
void travdetails::initial()
{
pool=gym=theatre=sports=salon=0;
}
void travdetails::accept(int c)
{
num1=c;
}
int travdetails::gtcode()
{
return trvtcode;
}
void travdetails::t_input(int cd) //input func()-class2
{
tob.initial();
trvtcode=cd;
int i=1,opt;
clrscr();
do
{
clrscr();
cout<<endl;
cout<<"\n\n\t\t\t\t__TRAVEL DETAILS__";
cout<<"\n\t\t\t\t";
cout<<"\n\n\t\tPlease enter the following details for your journey:";
cout<<"\n\n\t\t*Note:Options marked with are compulsory.\n\t\t\tPlease do select them.";
cout<<"“\n\n\n\t\t\t\t*1.Boarding Point\n\t\t\t\t*2.Destination\n\t\t\t\t*3.Date of Departure\n\t\t\t\t*4.Deck\n\t\t\t\t 5.Cabin\n\t\t\t\t 6.Swimming Pool\n\t\t\t\t 7.Gymnasuim\n\t\t\t\t 8.Sports\n\t\t\t\t 9.Salon\n\t\t\t\t 10.Spa\n\t\t\t\t 11.Theatre\n\t\t\t\t 12.Back\n\n\t\t\t\t ";
cin>>opt;
switch(opt)
{
case 1:clrscr();
cout<<"\n\n\n\t\t\tSelect Boarding point:\n\n\t\t\t1.Mumbai\n\n\t\t\t2.Cochin\n\n\t\t\t3.Chennai\n\n\t\t\t ";
cin>>bdg_pt;
break;
case 2:clrscr();
cout<<"\n\n\t\t\t****** Select Destination ******\n\n\n";
cout<<"\t 1.New York\t\t6.Dubai\t\t\t11.Antananariv";
cout<<"\n\n\t 2.Miami\t\t7.Lisbon\t\t12.Cairo\n\n";
cout<<"\t 3.Rio De Janeiro\t8.London\t\t13.Perth";
cout<<"\n\n\t 4.Colombo\t\t9.Copenhagen\t\t14.Sydney";
cout<<"\n\n\t 5.Hong Kong\t\t10.Cape Town\t\t15.Wellington\n\n\n\n\n\t\t\t\t ";
cin>>go_pt;
break;
case 3:clrscr();
cout<<"\n\n\t::::::::::::::::::: Date of Departure ::::::::::::::::::::";
cout<<"\n\n * Note:Format for entering:Day(press enter)Month(press enter)Year ";
cout<<"\n\n\t\tEnter your preferred date of departure: ";
cin>>day;
gotoxy(59,7); //to create a paricular format for entry
cout<<"/";
cin>>month;
gotoxy(62,7);
cout<<"/";
cin>>year;
break;
case 4:clrscr();
cout<<"\n\n\t\t\tEnter The Choice OF Deck\n\n\t\t\t1.Top Deck\n\n\t\t\t2.Middle Decks\n\n\t\t\t3.Bottom Deck\n\n\t\t\t ";
cin>>deck;
break;
case 5:clrscr();
cout<<"\n\n\t\t\tEnter The Choice Of Cabin\n\n\t\t\t1.AC\n\n\t\t\t2.Non AC\n\n\t\t\t";
cin>>cabin;
break;
case 6:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of A Swimming Pool\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>pool;
pool=2;
break;
case 7:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of A Gymnasium\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>gym;
gym=2;
break;
case 8:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Sports Facilities Offered\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>sports;
sports=2;
break;
case 9:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of Beauty Salon\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>salon;
salon=2;
break;
case 10:clrscr();
cout<<"\n\n\tDo You Like To Avail The Facility Of Spa and Ayurvedic Treatment\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>spa;
spa=2;
break;
case 11:clrscr();
cout<<"\n\n\t\tDo You Like To Avail The Facility Of Amphitheatre\n\n\t\t\t1.No\n\n\t\t\t2.Yes\n\n\t\t\t ";
cin>>theatre;
theatre=2;
break;
case 12:i=0;
break;
}
}while(i==1);
}
void boardpt(int c) //for easy o/p
{
if(c==1)
cout<<"Mumbai\t";
if(c==2)
cout<<"Cochin\t";
if(c==3)
cout<<"Chennai\t";
}
void dest(int d) //for easy o/p
{
switch(d)
{
case 1:cout<<"New York";
break;
case 2:cout<<"Miami";
break;
case 3:cout<<"Rio De Janero";
break;
case 4:cout<<"Colombo";
break;
case 5:cout<<"Hong Kong";
break;
case 6:cout<<"Dubai";
break;
case 7:cout<<"Lisbon";
break;
case 8:cout<<"London";
break;
case 9:cout<<"Copenhagen";
break;
case 10:cout<<"Cape Town";
break;
case 11:cout<<"Antananriv";
break;
case 12:cout<<"Cairo";
break;
case 13:cout<<"Perth";
break;
case 14:cout<<"Sydney";
break;
case 15:cout<<"Willington";
break;
}
}
void travdetails::t_output() //output func()-class2
{
clrscr();
cout<<"\n\n\t******************** TRAVEL DETAILS *********************";
cout<<"\n\n\t\tBoarding Point: ";
boardpt(bdg_pt);
cout<<"\n\n\t\tDestination: ";
dest(go_pt);
cout<<"\n\n\t\tDate of departure: ";
cout<<day<<"/"<<month<<"/"<<year;
cout<<"\n\n\t\tDeck: ";
switch(deck)
{
case 1:cout<<"Top Deck";
break;
case 2:cout<<"Middle Deck";
break;
case 3:cout<<"Bottom Deck";
break;
}
cout<<"n\n\t\tCabin: ";
switch(cabin)
{
case 1:cout<<"AC cabin";
break;
case 2:cout<<"Non-AC cabin";
break;
}
cout<<"\n\n\n\tFacilities availed for are:";
if(pool==2)
cout<<"\n\t\t\t\t Swimming Pool";
if(gym==2)
cout<<"\n\t\t\t\t Gymnasuim";
if(sports==2)
cout<<"\n\t\t\t\t Sports Facilities";
if(spa==2)
cout<<"\n\t\t\t\t Spa and Ayurvedic Treatment";
if(salon==2)
cout<<"\n\t\t\t\t Beauty Salon";
if(theatre==2)
cout<<"\n\t\t\t\t Theatre";
getch();
}
void family(int c,int&flag) //to display familyname+to check for record
{
flag=0;
clrscr();
ifstream ifl("PD.dat",ios::binary);
if(!ifl)
cout<<"\nError";
ifl.read((char*)&pob,sizeof(pob));
while(!ifl.eof())
{
if(pob.givecode()==c)
{
flag=1;
break;
}
ifl.read((char*)&pob,sizeof(pob));
}
if(flag==1)
{
cout<<"\n\n\t\t ****** ";
pob.givefam();
cout<<" FAMILY DATABASE ******";
}
else
{
cout<<"\nError in locating record!!";
}
ifl.close();
}
void editp(int c) //to edit persdetails
{
ofstream ofl2("temp1.txt",ios::binary);
if(!ofl2)
cout<<"Error While Opening File";
ifstream ifl4("PD.dat",ios::binary);
if(!ifl4)
cout<<"Error While Opening File";
ifl4.read((char*)&pob,sizeof(pob));
while(!ifl4.eof())
{
if(pob.givecode()==c)
{
clrscr();
cout<<"Please Enter the New details of the record"<<endl;
pob.p_input(c);
ofl2.write((char*)&pob,sizeof(pob));
cout<<"\n\t\t\tModification Succesful!!!";
ifl4.read((char*)&pob,sizeof(pob));
}
else
{
ofl2.write((char*)&pob,sizeof(pob));
ifl4.read((char*)&pob,sizeof(pob));
}
}
remove("PD.dat");
rename("temp1.dat","PD.dat");
ifl4.close();
ofl2.close();
getch();
}
void editt(int c) //to edit travdetails
{
ofstream ofl2("temp1.dat",ios::binary);
if(!ofl2)
cout<<"Error While Opening File";
ifstream ifl4("TD.dat",ios::binary);
if(!ifl4)
cout<<"Error While Opening File";
ifl4.read((char*)&tob,sizeof(tob));
while(!ifl4.eof())
{
if(tob.gtcode()==c)
{
clrscr();
cout<<"Please Enter the New details of the record"<<endl;
tob.t_input(c);
ofl2.write((char*)&tob,sizeof(tob));
cout<<"\n\t\t\tModification Succesful!!!";
ifl4.read((char*)&tob,sizeof(tob));
}
else
{
ofl2.write((char*)&tob,sizeof(tob));
ifl4.read((char*)&tob,sizeof(tob));
}
}
remove("TD.dat");
rename("temp1.dat","TD.dat");
ifl4.close();
ofl2.close();
getch();
}
void deletion(int c) //common delete func()
{
ofstream ofl2("temp1.dat",ios::binary);
if(!ofl2)
cout<<"Error While Opening File";
ifstream ifl4("PD.dat",ios::binary);
if(!ifl4)
cout<<"Error While Opening File";
ifl4.read((char*)&pob,sizeof(pob));
while(!ifl4.eof())
{
if(pob.givecode()!=c)
{
ofl2.write((char*)&pob,sizeof(pob));
}
ifl4.read((char*)&pob,sizeof(pob));
}
remove("PD.dat");
rename("temp1.dat","PD.dat");
ofl2.close();
ifl4.close();
ofstream ofl3("temp2.dat",ios::binary);
if(!ofl3)
cout<<"\nError While Opening File";
ifstream ifl5("TD.dat",ios::binary);
if(!ifl5)
cout<<"\nError While Opening File";
ifl5.read((char*)&tob,sizeof(tob));
while(!ifl5.eof())
{
if(tob.gtcode()!=c)
{
ofl3.write((char*)&tob,sizeof(tob));
}
ifl5.read((char*)&tob,sizeof(tob));
}
ofl3.close();
ifl5.close();
remove("TD.dat");
rename("temp1.dat","TD.dat");
cout<<"\n\n\t\tDeletion Completed!";
getch();
}
void travdetails::compute() //compution+bill generation
{
long int gttl=0,hr,dcst,dck,cabn,swpool=5000,gm=2000,spfts=7500,slon=6000,sp=20000,ttr=500;
switch(go_pt)
{
case 1:;
case 2:;
case 3:hr=30*24;
dcst=250000;
break;
case 4:;
case 5:;
case 6:hr=7*24;
dcst=75000;
break;
case 7:;
case 8:;
case 9:hr=24*24;
dcst=130000;
break;
case 10:;
case 11:;
case 12:hr=15*24;
dcst=100000;
break;
case 13:;
case 14:;
case 15:hr=12*24;
dcst=120000;
break;
}
switch(deck)
{
case 1:dck=7500;
break;
case 2:dck=5000;
break;
case 3:dck=1000;
}
switch(cabin)
{
case 1:cabn=5000;
break;
case 2:cabn=2000;
break;
}
clrscr();
cout<<"\n\n\t\t:::::::::::::::::::::: BILL ::::::::::::::::::::::::::";
cout<<"\n\n\t\tBoarding point:\t\t";
boardpt(bdg_pt);
cout<<"\n\n\t\tDestination:\t\t ";
dest(go_pt);
cout<<"\n\n\t\tDate of Departure: ";
cout<<day<<"/"<<month<<"/"<<year;
hr=hr/24; //to calculate date of arrival
day=day+hr;
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
{
if(day>31)
{
month=month+1;
day=day%31;
}
}
if(month==4||month==6||month==9||month==11)
{
if(day>30)
{
month=month+1;
day=day%30;
}
}
if(month==2)
{
if(day>28)
{
month=month+1;
day=day%28;
}
}
if(month==13)
{
month=1;
year++;
}
cout<<"\n\n\t\tDate of Arrival: ";
cout<<day<<"/"<<month<<"/"<<year;
cout<<"\n\n\t\tSubject\t\tCost(for 1)\tNo of ppl\tTotal";
cout<<"\n\n\t\tTravel\t\t"<<dcst<<"\t\t "<<num1<<"\t\t"<<num1*dcst;
gttl+=num1*dcst;
cout<<"\n\t\tDeck\t\t"<<dck<<"\t\t "<<num1<<"\t\t"<<dck*num1;
gttl+=dck*num1;
cout<<"\n\t\tCabin\t\t"<<cabn<<"\t\t "<<num1<<"\t\t"<<cabn*num1;
gttl+=cabn*num1;
if(pool==2)
{
cout<<"\n\t\tSwimming Pool\t"<<swpool<<"\t\t "<<num1<<"\t\t"<<swpool*num1;
gttl+=swpool*num1;
}
if(gym==2)
{
cout<<"\n\t\tGym\t\t"<<gm<<"\t\t "<<num1<<"\t\t"<<gm*num1;
gttl+=gm*num1;
}
if(sports==2)
{
cout<<"\n\t\tSports\t\t"<<spfts<<"\t\t "<<num1<<"\t\t"<<spfts*num1;
gttl+=spfts*num1;
}
if(salon==2)
{
cout<<"\n\t\tSalon\t\t"<<slon<<"\t\t "<<num1<<"\t\t"<<slon*num1;
gttl+=slon*num1;
}
if(spa==2)
{
cout<<"\n\t\tSpa\t\t"<<sp<<"\t\t "<<num1<<"\t\t"<<sp*num1;
gttl+=dcst*num1;
}
if(theatre==2)
{
cout<<"n\t\tTheatre\t\t"<<ttr<<"\t\t "<<"num"<<"\t\t"<<ttr*num1;
gttl+=ttr*num1;
}
cout<<"\n\n\n\t\t\t Grand Total:Rs ";
if(gttl>100000) //to provide comma’s for grandtotal
{
cout<<gttl/100000<<",";
gttl=gttl%100000;
}
if(gttl>1000)
{
cout<<gttl/1000<<",";
gttl=gttl%1000;
}
cout<<gttl;
if(gttl<10)
cout<<" ";
cout<<" ";
cout<<"\n\n\t! All Travellers below the age of 5 have not been charged !";
getch();
}
void main()
{
clrscr();
cout<<"\n\n\n\n\n"; //welcome screen
cout<<" * * * * * * * * * * * * * * * * * \n";
cout<<" * * * * * * * * * * * * * * \n";
cout<<" * * * * * * * * * * * * * * * * * * * \n";
cout<<"\n\n\n\n\n";
ifstream fl("INITIALL.dat",ios::binary); //initialisation of code
if(!fl)
cout<<"\nError";
fl.read((char*)&code,sizeof(code));
fl.close();
int opt,opt1,opt2,opt3,opt4;
int acceptcode,flag;
getch();
clrscr();
do
{
clrscr();
cout<<"\n\n\t\t\n";
cout<<"\t\t .WELCOME TO THE CRUISE DATABASE SYSTEM.\n";
cout<<"\t\t::::::::::::::::::: MAIN MENU :::::::::::::::::::\n";
cout<<"\n\t\t\tPlease select a kind of user:";
cout<<"\n\n\t\t\t\t1.New User\n\n\t\t\t\t2.Existing User\n\n\t\t\t\t3.Exit";
cout<<"\n\n\t\t\t\t ";
cin>>opt;
switch(opt)
{
case 1:do
{
clrscr();
cout<<"\n\n\n\t\t\t\t NEW USER\n";
cout<<"\t\t\t\t ********\n\n";
cout<<"\n\n\t\t\tChoose the type of details you want to enter:";
cout<<"\n\n\t\t\t\t1.Personal Details\n\n\t\t\t\t2.Travel Details\n\n\t\t\t\t3.Back\n\n\t\t\t\t ";
cin>>opt1;
switch(opt1)
{
case 1:code++;
pob.p_input(code);
ofstream ofl("PD.dat",ios::binary|ios::app);
if(!ofl)
cout<<"\n\n\t\tSorry.The File Cannot Be Opened For Writing"<<endl;
ofl.write((char*)&pob,sizeof(pob));
ofl.close();
break;
case 2:tob.t_input(code);
ofstream ofl1("TD.dat",ios::binary|ios::app);
if(!ofl1)
cout<<"\n\n\t\tSorry.The File Cannot Be Opened For Writing"<<endl;
ofl1.write((char*)&tob,sizeof(tob));
ofl1.close();
clrscr();
cout<<"\n\n\n\n!!!!!Your Details Have Been Registered.Please Make A Note Of This Code: "<<code;
cout<<"\n\n* For modifications,Please visit existing user’ section in the main screen";
getch();
break;
}
}while(opt1!=3);
break;
case 2:clrscr();
cout<<"\n\n\t\t\t***** EXISTING USER ***** \n\n\t\tPlease Enter The Travel Code That Was Given To You\n\n\t\t\t ";
cin>>acceptcode;
if(acceptcode>code)
{
cout<<"\nNo such record has been created!";
break;
}
family(acceptcode,flag);
cout<<endl<<endl<<"\t\t\t\tCode no:"<<acceptcode;
getch();
if(flag==1)
{
do
{
clrscr();
cout<<"\n\n\t\t\t Information Centre ";
cout<<"\n\t\t\t\t ~~~~~~~~~~~~~~~~~";
cout<<"\n\n\tPlease select the type of operation that you would like to perform:";
cout<<"\n\n\t\t\t1.View Personal Details\n\n\t\t\t2.View Travel Details\n\n\t\t\t3.Edit Details\n\n\t\t\t4.Compute Bill\n\n\t\t\t5.Back\n\n\t\t\t ";
cin>>opt2;
switch(opt2)
{
case 1:ifstream ifl("PD.dat",ios::binary);
if(!ifl)
cout<<"\nError";
ifl.read((char*)&pob,sizeof(pob));
while(!ifl.eof())
{
if(pob.givecode()==acceptcode)
{
break;
}
ifl.read((char*)&pob,sizeof(pob));
}
pob.p_output();
ifl.close();
break;
case 2:ifstream ifl1("TD.dat",ios::binary);
if(!ifl1)
cout<<"\nError";
ifl1.read((char*)&tob,sizeof(tob));
while(!ifl1.eof())
{
if(tob.gtcode()==acceptcode)
{
break;
}
ifl1.read((char*)&tob,sizeof(tob));
}
tob.t_output();
ifl1.close();
break;
case 3:do
{
clrscr();
cout<<"\n\n\n\t>>>>>>>>>>>>>>>>>> Edit Details <<<<<<<<<<<<<<<<<<<<<<";
cout<<"\n\n\t\tPlease select from among the editing options:\n\n";
cout<<"\t\t\t\t1.Modify\n\n\t\t\t\t2.Delete\n\n\t\t\t\t3.Back\n\n\t\t\t\t ";
cin>>opt3;
switch(opt3)
{
case 1:do
{
clrscr();
cout<<"\n\n\t\t............... Modificaton ...................\n";
cout<<"\t\t ";
cout<<"\n\n\tChoose The Type Of Details You Want To Modify:\n\n\t\t\t1.Personal Details\n\n\t\t\t2.Travel Details\n\n\t\t\t3.Back\n\n\t\t\t ";
cin>>opt4;
switch(opt4)
{
case 1:editp(acceptcode);
break;
case 2:editt(acceptcode);
break;
case 3:break;
}
}while(opt4!=3);
break;
case 2:deletion(acceptcode);
opt3=3;
opt2=5;
break;
case 3:break;
}
}while(opt3!=3);
break;
case 4:ifstream ifl3("PD.dat",ios::binary);
if(!ifl3)
cout<<"\nError";
ifl3.read((char*)&pob,sizeof(pob));
while(!ifl3.eof())
{
if(pob.givecode()==acceptcode)
{
break;
}
ifl3.read((char*)&pob,sizeof(pob));
}
ifstream ifl2("TD.dat",ios::binary);
if(!ifl2)
cout<<"\nError";
ifl2.read((char*)&tob,sizeof(tob));
while(!ifl2.eof())
{
if(tob.gtcode()==acceptcode)
{
break;
}
ifl2.read((char*)&tob,sizeof(tob));
}
tob.accept(pob.give());
tob.compute();
ifl2.close();
break;
case 5:break;
}
}while(opt2!=5);
}
break;
case 3:ofstream fil("INITIALL.dat",ios::binary); //storing code value
if(!fil)
cout<<"\nError";
fil.write((char*)&code,sizeof(code));
fil.close();
clrscr();
cout<<"\n\n";
getch();
exit(0);
}
getch();
}while(1); //infinite loop till exit selected
}