-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ticket_Reservation_System.cpp
144 lines (136 loc) · 3.78 KB
/
Ticket_Reservation_System.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
#include <iostream>
#include <conio.h>
using namespace std;
class Bus
{
int buses,busid[20];
string desti[20],time[20];
public:
void enter_data();
void display_data();
void delete_data();
void booking_ticket();
};
void Bus :: enter_data()
{
system ("CLs");
cout<<" ***************Bus Entries***************\n\n\n";
cout<<"How many Buses you want to Enter : ";
cin>>buses;
for ( int i = 0 ; i < buses ; i++)
{
system ("CLS");
cout<<endl<<"\nBus No."<<"("<<i<<")\n";
cout<<"\nEnter Bus Id : ";
cin>>busid[i];
cout<<"\nEnter the Destination : ";
cin>>desti[i];
cout<<"\nEnter time of Travel : ";
cin>>time[i];
cout<<"\n\nBus Added Successfully.\n";
getch();
}
}
void Bus :: display_data()
{
int dispbus;
system ("CLS");
cout<<" ***************Displaying Bus Entries***************\n\n\n";
cout<<"Enter the Bus ID which You want to display : ";
cin>>dispbus;
cout<<"\n-----------Following are the Details of Bus-----------";
for (int i = 0 ; i<buses ; i++)
{
if(dispbus == busid[i])
{
cout<<"\n\n\nBus ID : "<<busid[i];
cout<<"\n\nThe Destination of Bus is "<<desti[i];
cout<<"\n\nThe Time Travel of this Bus is "<<time[i];
getch();
}
}
}
void Bus :: delete_data()
{
int delid;
system ("CLS");
cout<<" ______________Deletion of Bus Data______________\n\n\n";
cout<<"Which ID You Want to Delete : ";
cin>>delid;
for ( int m = 0 ; m<buses ; m++)
{
if (delid == busid[m])
{
busid[m] = 0;
desti[m] = "";
time[m] = "";
}
}
cout<<"\n\nBus ID Deleted Successfully...\n";
getch();
}
void Bus :: booking_ticket()
{
system ("CLS");
long book,CNIC;
string name,time;
cout<<" *********Welcome Here For Booking Of Tickets*********";
cout<<"\n\n\nEnter How Many Tickets You Want to Book : ";
cin>>book;
for (int p = 1 ; p <= book ; p++)
{
cout<<"\n\nTicket No. : "<<p;
cout<<"\n\nEnter Your Name : ";
cin.ignore();
getline (cin , name);
cout<<"\nCNIC No. : ";
cin>>CNIC;
cout<<"\n\nEnter Time of Bus : ";
cin.ignore();
getline (cin ,time);
cout<<"\n\n\n__________________Thanks for Booking Ticket__________________\n\n\n";
getch();
}
}
int main()
{
int select = 0;
Bus bus;
do
{
system("CLS");
cout<<" ----------------------------------- \n";
cout<<" ************ | Welcome to Ticet Reservation System | ************\n";
cout<<" ----------------------------------- \n";
cout<<"\n\n\n1. Enter Bus Data";
cout<<"\n\n2. Display Bus Data";
cout<<"\n\n3. Delete Bus Data";
cout<<"\n\n4. Booking of Tickets";
cout<<"\n\n5. Exit";
cout<<"\n\n\n\t Which Option you want to select : ";
cin>>select;
switch (select)
{
case 1:
bus.enter_data();
break;
case 2:
bus.display_data();
break;
case 3:
bus.delete_data();
break;
case 4:
bus.booking_ticket();
break;
case 5:
system("CLS");
cout << " *******************************************\n";
cout << "\n\n Thanks For Checking Ticket Reservation System\n\n\n";
cout << " *******************************************\n\n";
getch();
exit(0);
}
}
while (select != 5);
}