0% found this document useful (0 votes)
110 views22 pages

Bus Reservation System

This document defines several C++ classes related to a transportation reservation system. It includes classes like Passenger, Seats, Reservations, TimeTables, and Payments. Methods are defined to make and modify reservations, check seat availability, calculate fees, and display timetables and payment schemes by reading external files. Constructors are provided to initialize class objects with user input values.

Uploaded by

Preeti Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views22 pages

Bus Reservation System

This document defines several C++ classes related to a transportation reservation system. It includes classes like Passenger, Seats, Reservations, TimeTables, and Payments. Methods are defined to make and modify reservations, check seat availability, calculate fees, and display timetables and payment schemes by reading external files. Constructors are provided to initialize class objects with user input values.

Uploaded by

Preeti Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

1.

nclude <iostream>
2. #include <fstream>
3. #include <cstdio>
4. #include <conio.h>
5. #include <cstdlib>
6. #include <stdio.h>
7.
8. using namespace std;
9.
10. int count01 ;
11.
12. // class Passenger
13. class Passenger
14. {
15. string str_City, str_ContactNumber, str_UserName,
str_Password, str_name ;
16.
17. protected:
18.
19. string str_NIC ;
20.
21. public:
22.
23. Passenger(){}
24. Passenger(string name, string NIC, string City, string
ContactNumber, string Username, string Password) ;
25. void Login();
26. void SearchFile_and_Update() ;
27. void Deletes() ;
28. ~Passenger() ;
29.
30. };
31.
32. // class Seats
33.
34. class Seats{
35.
36. protected:
37.
38. int i_SeatNo ;
39.
40. public:
41.
42. void CheckSeatAvailabilty() ;
43.
44. };
45.
46.
47.
48. // class Reservations
49.
50. class Reservations : public Passenger,public Seats{
51.
52. protected :
53.
54. string str_Arrival_St, str_Dep_St ;
55.
56. int i_No_Tickets, i_Charge ;
57. double i_total ;
58.
59.
60. public:
61.
62. Reservations();
63. // to make a reservation
64. Reservations(string NIC, string DeptSt, string ArrivalSt,
int NoTickets );
65.
66. void SearchFile_and_Update();
67. // ModifyReservation Function
68. void Deletes();
69. // cancel reservation function
70. void Show(string, string, string, int, int, int);
71.
72. double CalculateFee(double, int) ;
73.
74. ~Reservations();
75.
76. };
77.
78. // class TimeTables
79.
80. class TimeTables : public Reservations{
81.
82. public:
83. void Show()const ;
84.
85. ~TimeTables ();
86. };
87.
88. // class Payments
89. class Payments: public Reservations{
90.
91.
92. public :
93. void Show()const ;
94.
95. ~Payments();
96.
97. };
98.
99.
100. // payments - show
101.
102. inline void Payments :: Show()const{
103.
104.
105.
106. fstream payments ;
107. payments.open("Payments.txt",ios :: in) ;
108. string line ;
109. cout << "\n\n-----------------Payment Scheme----
--------------\n\n" ;
110.
111. while(!payments.eof()){
112.
113. getline(payments,line);
114. cout << line << "\n" ;
115.
116.
117. }
118. }
119.
120. // timetables - Show
121.
122. inline void TimeTables :: Show()const{
123.
124.
125. string line2 ;
126.
127. ifstream timetable("Timetables.txt") ;
128.
129.
130. cout << "\n\n----------------TimeTable----------
---------------\n\n" ;
131.
132. while(!timetable.eof()){
133.
134. getline(timetable,line2) ;
135. cout << line2 << "\n\n" ;
136.
137.
138. }
139.
140. }
141.
142. // Reservations constructor
143.
144. inline Reservations :: Reservations(string NIC, string DeptSt,
string ArrivalSt, int NoTickets ){
145.
146. Reservations r2 ;
147.
148.
149. str_NIC = NIC ;
150. str_Dep_St = DeptSt ;
151. str_Arrival_St = ArrivalSt ;
152. i_No_Tickets = NoTickets ;
153.
154. ifstream PaymentsRead ;
155. PaymentsRead.open("Payments.txt") ;
156.
157.
158. double ch ;
159.
160.
161. string s1,s2 ;
162.
163. while(PaymentsRead >> s1 >> s2 >> ch){
164.
165. if((str_Dep_St == s1) &
(str_Arrival_St == s2)){
166.
167.
168. i_total = CalculateFee(ch,
i_No_Tickets);
169. }
170.
171. }
172.
173.
174.
175. char confirmation ;
176.
177. cout << "\n\nConfirm the
Reservation(Y/N): \n\n" ;
178. cin >> confirmation ;
179. confirmation = tolower(confirmation);
180.
181.
182. if(confirmation == 'y'){
183.
184. fstream Reservations ;
185. fstream Seats ;
186.
187. string line ;
188.
189.
190.
Reservations.open("Reservations.txt", ios::app | ios:: out | ios::ate);
191.
192. Seats.open("Seat.txt", ios :: app |
ios :: out | ios :: ate | ios :: in);
193.
194.
195.
196.
197. Seats << str_NIC << "\t" <<
i_No_Tickets <<"\n" ;
198.
199. Reservations << str_NIC <<"\t"<<
str_Dep_St <<"\t"<< str_Arrival_St <<"\t"<< i_No_Tickets
200. << "\t" << i_total
<<"\n";
201.
202. Reservations.close();
203. }
204.
205. else{
206.
207. cout << "\n\nConfirmation denied and
exiting from the program \n" ;
208. exit(0) ;
209. }
210.
211.
212. r2.Show(str_NIC, str_Dep_St,
str_Arrival_St, i_No_Tickets, ch, i_total ) ;
213.
214.
215. }
216.
217. // modify Reservation function
218.
219. inline void Reservations :: SearchFile_and_Update(){
220.
221.
222. Reservations r1 ;
223. double ch;
224. char confirmation ;
225. int s7;
226.
227.
228. ifstream reservationsIn ;
//SEARCH
229. ifstream seatsIn; //search
230.
231. fstream reservationsOut ;
232. fstream seatsOut ;
233.
234. cout << "\n\nConfirm the You
wants to modify reservation(Y/N): \n\n" ;
235. cin >> confirmation ;
236. confirmation =
tolower(confirmation) ;
237. system("CLS");
238.
239. if(confirmation == 'y'){
240.
241.
242. TimeTables T1 ;
243. Payments P1 ;
244. T1.Show();
245. P1.Show() ;
246.
247. cout << "\n\n-------------------
------------------------------\n\n" ;
248.
249. cout <<"\n\nEnter new your NIC
:\n\n" ;
250. cin >> str_NIC ;
251.
252. cout << "\n\n------------------
-------------------------------\n\n" ;
253.
254. cout << "\n\n New Depature
station\n\n " ;
255. cin >> str_Dep_St ;
256.
257. cout << "\n\n New Arrival
station\n\n " ;
258. cin >> str_Arrival_St ;
259.
260.
261. cout << "\n\nNew No. of
Tickets\n\n " ;
262. cin >> i_No_Tickets ;
263.
264.
265. fstream PaymentsRead ;
266.
PaymentsRead.open("Payments.txt", ios :: in) ;
267.
268.
269. string s1,s2,s3,s4,s5,s6 ;
270.
271.
272. while(PaymentsRead >> s1 >>
s2 >> ch){
273.
274. if((str_Dep_St ==
s1) & (str_Arrival_St == s2)){
275. cout << ch ;
276. i_total =
CalculateFee(ch, i_No_Tickets);
277. }
278.
279. } cout << ch ;
280.
281. reservationsIn.open("Reservations.txt");
282. seatsIn.open("Seats.txt") ;
283.
284. while(reservationsIn >> s1 >> s2 >>
s3 >> s4 >> s5){
285.
286.
reservationsOut.open("temp7.txt",ios :: app) ;
287.
288.
289. if(s1 == str_NIC){
290.
291.
292.
293. while(seatsIn >> s6 >>
s7){
294.
295.
seatsOut.open("temp8.txt",ios :: app) ;
296.
297.
298.
299. if(s6 ==
str_NIC){
300.
301.
302.
303. seatsOut
<< str_NIC << "\t" << i_No_Tickets << "\n";
304.
305.
reservationsOut << str_NIC <<"\t"<< str_Dep_St <<"\t"<< str_Arrival_St
<<"\t"<< i_No_Tickets
306.
<< "\t" << i_total << "\n";
307.
308. cout <<
"\n\nRecord found & updated!\n\n" ;
309. cout <<
"\n\n-------------------------------------------------\n\n" ;
310.
311.
count01 ++ ;
312.
313. }
314.
315. else {
316.
317. seatsOut
<< s6 << "\t" << s7 << "\n";
318.
319.
reservationsOut << s1 <<"\t"<< s2 <<"\t"<< s3 <<"\t"<< s4<<"\t"
320.
<< s5 <<"\n";
321.
322.
323. }
324.
325.
seatsOut.close();
326.
reservationsOut.close();
327.
328.
329. } // end of while - match4
330.
331. } // end of outer if
332.
333. } // end of outer while
334.
335. }// end of confirmation if
336.
337.
338.
339.
340. if(count01 == 0){
341.
342. cout << "\n\nRecord
could not be found!\n\n" ;
343. remove("temp7.txt")
;
344. remove("temp8.txt")
;
345.
346. }
347.
348. if(count01 != 0){
349.
350.
remove("Reservations.txt");
351. int r =
rename("temp7.txt","Reservations.txt");
352. remove("Seats.txt");
353. int r2 =
rename("temp8.txt","Seats.txt");
354.
355. if ( (r == 0) &
(r2 == 0) )
356. puts (
"File successfully renamed" );
357. else
358. perror(
"Error renaming file" );
359. }
360.
361.
362. seatsOut.close() ;
363.
reservationsOut.close();
364. cout <<
"\n\nDone!\n\n" ;
365.
366.
367.
368. r1.Show(str_NIC,
str_Dep_St, str_Arrival_St, i_No_Tickets,ch, i_total ) ;
369.
370. }
371.
372. // cancel Reservations
373.
374. inline void Reservations :: Deletes(){
375.
376.
377. char confirmation ;
378. string nic, nic2, dept, arr, s8;
379. int nt, ch, tot,sn;
380. ifstream ResIn ; //reservations
381. ifstream SeatIn ; //seats
382.
383. fstream ResOut ;
384. fstream SeatOut ;
385.
386.
387. cout << "\n\nConfirm to Cancel
the Reservation(Y/N): \n\n" ;
388. cin >> confirmation ;
389. confirmation =
tolower(confirmation) ;
390.
391. if(confirmation == 'y'){
392.
393.
394.
395. cout << "\n\n-------------------
------------------------------\n\n" ;
396.
397. cout <<"\n\nEnter your NIC
:\n\n" ;
398. cin >> str_NIC ;
399.
400. cout << "\n\n------------------
-------------------------------\n\n" ;
401.
402.
403.
404. ResIn.open("Reservations.txt");
405. SeatIn.open("Seats.txt") ;
406.
407.
408. while(ResIn >> nic >> dept >> arr >>
nt >> ch >> tot){
409.
410. ResOut.open("temp5.txt",ios ::
app | ios :: out) ;
411.
412.
413. if(nic != str_NIC){
414.
415.
416. while(SeatIn >> nic2 >>
sn){
417.
418.
SeatOut.open("temp6.txt",ios :: app | ios :: out) ;
419.
420. if(nic2 !=
str_NIC){
421.
422.
423.
424. SeatOut
<< nic2 << "\t" << nt << "\n";
425.
426. ResOut
<< nic <<"\t"<< dept <<"\t"<< arr <<"\t"<< nt <<"\t"<< ch
427.
<< tot << "\n";
428.
429.
430.
431. }
432.
433. else {
434.
435. count01
++ ;
436.
437.
438. }
439.
440. } // end of while - match4
441.
442. } // end of outer if
443.
444. } // end of outer while
445. }// end of confirmation if
446.
447. ResOut.close();
448. SeatOut.close();
449.
450.
451.
452. if(count01 == 0){
453.
454. cout << "\n\nRecord
could not be found!\n\n" ;
455. remove("temp5.txt")
;
456. remove("temp6.txt")
;
457.
458. }
459.
460. if(count01 > 0){
461.
462.
remove("Reservations.txt");
463.
rename("temp5.txt","Reservations.txt");
464. remove("Seats.txt");
465.
rename("temp6.txt","Seats.txt");
466. }
467.
468.
469. ResIn.close() ;
470. cout <<
"\n\nDone!\n\n" ;
471.
472.
473.
474.
475.
476. }
477.
478. // Reservations - Show
479. inline void Reservations :: Show(string NIC, string Dept_St, string
Arrival_St, int No_Tickets, int Charge, int total ){
480.
481. system("CLS") ;
482.
483. cout <<"\n\nNIC :" << NIC << "\n"
484. <<"\n\nDep. St. :" << Dept_St << "\t\t"
485. <<"Arrival St. :" << Arrival_St <<"\n\n"
486. <<"No_Tickets :" << No_Tickets <<"\t"
487. <<"Charge for one ticket :" << Charge <<"\t"
488. << "total = " << total <<"\n\n" ;
489.
490.
491. }
492.
493. // Reservations Deconstructor
494.
495. inline Reservations :: ~Reservations(){}
496.
497.
498. // Payments Calculate
499. inline double Reservations :: CalculateFee(double fee, int nt)
500. {
501. i_total = nt * fee ;
502. return i_total ;
503. }
504.
505.
506. // Seats - CheckSeatAvailability
507. inline void Seats :: CheckSeatAvailabilty(){
508.
509. int NoLines = 0 ;
510. string line ;
511. ifstream SeatAvailbility ;
512.
513. SeatAvailbility.open("Seats.txt");
514.
515. while(SeatAvailbility.eof()){
516.
517. getline(SeatAvailbility,line) ;
518. NoLines ++;
519.
520.
521.
522. }
523.
524. i_SeatNo = NoLines ;
525.
526.
527.
528. if(i_SeatNo == 32 ){
529.
530. cout <<"\n\nSeats are not available at
the moment.\n\n" ;
531. }
532.
533. else
534. {
535.
536.
537. cout <<"\n\n" << 32 - i_SeatNo << " are
available.\n\n" ;
538.
539. }
540.
541. SeatAvailbility.close();
542. } // seat availability function end
543.
544. // Delete record function
545. inline void Passenger :: Deletes(){
546.
547.
548.
549. string nic, name, city, username, password ,
cn;
550.
551. cout <<"\n\nEnter your NIC to delete the record
:\n\n" ;
552. cin >> str_NIC ;
553.
554.
555. fstream deleteF ;
556. ofstream df ;
557.
558. deleteF.open("Passenger.txt", ios::in | ios
:: out);
559.
560.
561. while(deleteF >> nic >> name >> city >>
cn >>username >> password){
562.
563. df.open("temp2.txt",ios :: ate )
;
564.
565. if(nic != str_NIC){
566.
567. df << nic <<"\t"<<
name <<"\t"<< city <<"\t"
568. << cn <<"\t"<<
username
569. <<"\t" <<
password << "\n";
570.
571. }
572.
573.
574. else {
575.
576. count01 ++ ;
577. }
578.
579. df.close() ;
580.
581.
582. }// end of while
583.
584. deleteF.close() ;
585. if(count01 == 0){
586.
587. remove("temp2.txt")
;
588. cout << "\n\nRecord
not found\n\n" ;
589.
590. }
591.
592. if(count01 > 0){
593.
594.
remove("Passenger.txt");
595.
rename("temp2.txt","Passenger.txt");
596.
597. }
598.
599.
600. cout << "\n\nDone!\n\n" ;
601.
602.
603. }//end of function DeleteRecord
604.
605.
606. // Search file and update
607. inline void Passenger :: SearchFile_and_Update(){
608.
609.
610.
611.
612. string nic, name, city, username, password ,
cn;
613.
614. cout << "\n\n-------------------
------------------------------\n\n" ;
615.
616. cout <<"\n\nEnter your NIC
:\n\n" ;
617. cin >> str_NIC ;
618.
619.
620.
621. ifstream PassengerIn ;
622. ofstream writeFile ;
623.
624. PassengerIn.open("Passenger.txt");
625.
626.
627. while(PassengerIn >> nic >> name >>
city >> cn >>username >> password){
628.
629. writeFile.open("temp1.txt",ios
:: app ) ;
630.
631.
632. if(nic == str_NIC){
633.
634.
635. cout << "\n\nRecord
found!\n\n" ;
636.
637. cout << "\n\n-----------
--------------------------------------\n\n" ;
638.
639.
640. cout << "\n\nNew
Passenger Name:\n\n " ;
641. cin >> str_name ;
642.
643. cout << "\n\nNew
Passenger City:\n\n " ;//address change to city
644. cin >> str_City ;
645.
646. cout << "\n\nNew
Passenger : Contact No\n\n " ;
647. cin >> str_ContactNumber
;
648.
649. cout << "\n\nNew
Passenger : UserName \n\n " ;
650. cin >> str_UserName ;
651.
652. cout << "\n\nNew
Passenger : Password\n\n " ;
653. cin >> str_Password ;
654.
655.
656. writeFile << str_NIC
<<"\t"<< str_name <<"\t"<< str_City <<"\t"
657. <<
str_ContactNumber <<"\t"<< str_UserName
658. <<"\t" <<
str_Password << "\n";
659.
660.
661. count01 ++ ;
662.
663.
664. }
665.
666. else{
667.
668. writeFile << nic
<<"\t"<< name <<"\t"<< city <<"\t"
669. << cn <<"\t"<<
username
670. <<"\t" <<
password << "\n";
671.
672.
673. }
674.
675.
676. writeFile.close();
677.
678.
679.
680.
681.
682. }// end of while
683.
684.
685. PassengerIn.close() ;
686. if(count01 == 0){
687.
688. cout << "\n\nRecord
could not be found!\n\n" ;
689. remove("temp1.txt")
;
690.
691. }
692.
693. if(count01 > 0){
694.
695.
remove("Passenger.txt");
696.
rename("temp1.txt","Passenger.txt");
697.
698.
699. }
700.
701.
702. cout <<
"\n\nDone!\n\n" ;
703.
704. }
705.
706.
707. // Login
708. inline void Passenger :: Login()
709.
710. {
711.
712. string username01, password01 ;
713.
714. cout <<"--------------------------------
-----------"
715. << "\n\nLogin Screen\n\n"
716. << "\n\nEnter your UserName:\n\n" ;
717.
718. cin >> username01 ;
719.
720. cout << "\n\nEnter your Password:\n\n" ;
721. //system("COLOR 6E") ;
722. cin >> password01 ;
723.
724. ifstream matchup ;
725. matchup.open("Passenger.txt", ios::in );
726.
727.
728. string s1,s2, s3, s4, s5, s6 ;
729.
730. while(matchup >> s1 >> s2 >> s3 >> s4 >> s5 >>
s6 ){
731.
732.
733. if(s5 == username01 && s6 == password01
){
734.
735. cout <<"\n\nLogged in
Successfully.\n\n";
736. }
737. ///////
738. } //end of while
739.
740. }
741.
742. // Passenger constructor
743. inline Passenger :: Passenger(string name, string NIC, string
City, string ContactNumber, string Username, string Password){
744.
745.
746. str_name = name ;
747. str_NIC = NIC ;
748. str_City = City ;
749. str_ContactNumber = ContactNumber ;
750. str_UserName = Username ;
751. str_Password = Password ;
752.
753.
754. fstream registration ;
755.
756. registration.open("Passenger.txt", ios::app | ios::
out | ios::ate);
757.
758. registration << str_NIC <<"\t"<< str_name <<"\t"<<
str_City <<"\t"<< str_ContactNumber <<"\t"<< str_UserName
759. <<"\t" << str_Password << "\n";
760.
761. registration.close();
762.
763.
764.
765. }
766.
767. // Passenger deconstructor
768. inline Passenger :: ~Passenger(){}
769.
770. inline TimeTables :: ~TimeTables(){}
771.
772. inline Payments :: ~Payments(){}
773.
774.
775. // Reservations constructor
776. inline Reservations :: Reservations(){}
777.
778.
779. /*******************************************************************
******************************************************************/
780.
781.
782.
783. int main()
784. {
785.
786.
787. int mainchoice, subChoiceOne , nt ;
788. string name, NIC, City, Password, UserName, ContactNumber,
DepSt, ArrSt;
789.
790.
791.
792. try{
793.
794. mainMenu :
795.
796.
797. system("COLOR 70");
798. cout << "\n\n Welcome to SPRPTA Bus Ticket Reservation
System \n\n" ;
799.
800.
801.
802. cout << "\n\n 1.Customer\n\n"
803. << " 2.Reservation\n\n"
804. << " 3.Exit\n\n"
805. << "\n\n Enter your choice :" ;
806. try{
807.
808. cin >> mainchoice ;
809.
810. if ((mainchoice !=1) & (mainchoice != 2) & (mainchoice
!= 3 )){
811.
812. throw 11 ;
813.
814.
815. }
816. }
817.
818. catch(int x){
819.
820. perror("\n\n Please select a Relevant Number from the
menu \n\n" );
821. return main() ;
822.
823. }
824. switch(mainchoice){
825.
826.
827.
828. case 1:{
829. subMenu :
830. system("CLS");
831.
832. cout << "-------------------------------
------------------\n\n"
833. << "\n\n1.Register\n\n"
834. << "2.Modify\n\n"
835. << "3.Remove Account\n\n"
836. << "\n\nEnter your choice :" ;
837. try{
838.
839. cin >> subChoiceOne ;
840.
841. if ((subChoiceOne !=1) & (subChoiceOne != 2) &
(subChoiceOne != 3 )){
842.
843. throw 12 ;
844.
845.
846. }
847. }
848. catch(int y){
849.
850. perror( "\n\nError - Please select a Relevant Number
from the menu \n\n") ;
851. goto mainMenu ;
852. system("CLS");
853.
854. }
855.
856.
857. switch(subChoiceOne){
858.
859. case 1: {
860.
861.
862. system("CLS");
863.
864.
865. cout << "----------------------
---------------------------\n\n"
866. << "Please fill in this
information for the Registration";
867.
868.
869. cout << "\n\nPassenger
Name:\n\n " ;
870. cin >> name ;
871.
872. cout << "\n\nPassenger NIC:\n\n
" ;
873. cin >> NIC ;
874.
875. cout << "\n\nPassenger City:\n\n
" ;
876. cin >> City ;
877.
878. cout << "\n\nPassenger : Contact
No\n\n " ;
879. cin >> ContactNumber ;
880.
881. cout << "\n\nPassenger :
UserName \n\n " ;
882. cin >> UserName ;
883.
884. cout << "\n\nPassenger :
Password\n\n " ;
885. cin >> Password ;
886. //make the password protective
887.
888.
889. Passenger P1(name, NIC, City, ContactNumber
, UserName, Password );
890.
891. cout << "\n\nPress any key to move to the
sub Menu.\n\n" ;
892.
893. system("PAUSE") ;
894. system("CLS");
895. goto subMenu ;
896. system("CLS");
897.
898. }; // Sub choice first case
899.
900.
901. break ;
902.
903.
904. case 2:{
905.
906. system("CLS");
907. Passenger P2 ;
908. P2.Login() ;
909. P2.SearchFile_and_Update() ;
910.
911.
912. cout << "Press any key to move
to the sub Menu.\n\n" ;
913.
914. system("PAUSE") ;
915. goto subMenu ;
916. system("CLS");
917.
918.
919.
920.
921. } ;
922.
923. break ;
924.
925.
926.
927. case 3:{
928.
929. system("CLS");
930. Passenger P3 ;
931. P3.Login() ;
932. P3.Deletes() ;
933.
934. cout << "Press any key to move to
the sub Menu.\n\n" ;
935.
936. system("PAUSE") ;
937. goto subMenu ;
938. system("CLS");
939.
940. };
941.
942. break ;
943.
944. }//sub switch one
945.
946. };//main choice first case
947.
948. break ;
949.
950. case 2:{
951. system("CLS");
952. int subChoice2 ;
953.
954.
955. cout << "-----------------------------------
--------------\n\n"
956. << "\n\n1.Make a Reservation\n\n"
957. << "2.Modify Reservation\n\n"
958. << "3.Cancel Reservation\n\n"
959. << "\n\nEnter your choice :" ;
960.
961.
962. cin >> subChoice2 ;
963.
964.
965. switch(subChoice2){
966.
967.
968. case 1:{
969.
970.
971.
972. system("CLS");
973. Reservations R2 ;
974. R2.Login() ;
975. char check ;
976.
977.
978. system("CLS");
979. cout << "\n\nCheck seat
availabilty(Y/N) ?\n" ;
980. cin >> check ;
981. check = tolower(check);
982.
983. if(check == 'y'){
984.
985. TimeTables T1 ;
986. Payments P1 ;
987.
988. R2.CheckSeatAvailabilty();
989. T1.Show();
990. P1.Show();
991.
992.
993. cout << "\n\n Passenger NIC:\n\n
" ;
994. cin >> NIC ;
995.
996. cout << "\n\n Depature
station\n\n " ;
997. cin >> DepSt ;
998.
999. cout << "\n\n Arrival
station\n\n " ;
1000. cin >> ArrSt ;
1001.
1002. cout << "\n\nNo. of Tickets\n\n
" ;
1003. cin >> nt ;
1004.
1005. Reservations R2(NIC,DepSt,
ArrSt, nt);
1006.
1007. }
1008. goto mainMenu ;
1009. };
1010.
1011.
1012. break ;
1013.
1014.
1015.
1016.
1017. case 2:{
1018. system("CLS");
1019. Reservations R3 ;
1020. R3.Login() ;
1021. R3.SearchFile_and_Update()
;
1022.
1023. cout << "Press any key to
move to the main Menu.\n\n" ;
1024.
1025. system("PAUSE") ;
1026. goto mainMenu ;
1027. system("CLS");
1028.
1029.
1030. };
1031. break ;
1032.
1033. case 3:{
1034. system("CLS");
1035. Reservations R4 ;
1036. R4.Login() ;
1037. R4.Deletes() ;
1038.
1039. cout << "Press any key
to move to the main Menu.\n\n" ;
1040.
1041. system("PAUSE") ;
1042. goto mainMenu ;
1043. system("CLS");
1044.
1045.
1046.
1047.
1048.
1049. };
1050.
1051.
1052. break ;
1053.
1054.
1055. } // second sub switch end
1056.
1057.
1058. //main switch case 2 ;
1059.
1060. };
1061. break ;
1062. case 3:{
1063. system("CLS");
1064. exit(0);
1065.
1066. };
1067. break ;
1068.
1069. } // main switch end
1070.
1071.
1072. }
1073.
1074.
1075. catch(...){
1076.
1077. perror ("\n\nUnexpected Error occoured, Program is
terminating\n\n") ;
1078. exit(0);
1079.
1080. }
1081.
1082. return 0;
1083.
1084. }

You might also like