-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
229 lines (212 loc) · 7.73 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
#include<iostream>
#include<istream>
#include<fstream>
#include<stdlib.h>
#include<string.h>
#include "bluesky.cpp" // Included main.cpp file to run Airline system after login
using namespace std;
void login();
void registr();
void forgot();
main()
{
int choice;
cout<<" * *\n";
cout<<" ** **\n";
cout<<" *** ***\n";
cout<<" *****************************\n";
cout<<" ***************AIR*************D\n";
cout<<" *****************************\n";
cout<<" ****\n";
cout<<" ***\n";
cout<<" **\n";
cout<<" *\n\n";
cout<<"***********************************************************************\n";
cout<<" Welcome to Flyaway.com \n\n";
cout<<"******************* MENU *******************************\n";
cout<<"Please login or Register to continue\n";
cout<<"1.LOGIN"<<endl;
cout<<"2.REGISTER"<<endl;
cout<<"3.FORGOT PASSWORD (or) USERNAME"<<endl;
cout<<"4.Exit"<<endl;
cout<<"\nEnter your choice :";
cin>>choice;
cout<<endl;
switch(choice)
{
case 1:
login();
break;
case 2:
registr();
break;
case 3:
forgot();
break;
case 4:
cout<<"Thank you.\n Have a nice day.\n";
break;
default:
system("cls");
cout<<"You've made a mistake , give it a try again\n"<<endl;
main();
}
}
void login()
{
int count;
string user,pass,u,p;
system("cls");
cout<<"please enter the following details"<<endl;
cout<<"USERNAME :";
cin>>user;
cout<<"PASSWORD :";
cin>>pass;
ifstream input("database.txt");
while(input>>u>>p)
{
if(u==user && p==pass)
{
count=1;
system("cls");
}
}
input.close();
if(count==1)
{
cout<<"\nHello"<<user<<"\nLOGIN SUCESS\nWe're glad that you're here.\nThanks for logging in\n";
system("CLS"); // clean the terminal
//FLIGHT PATTERNS STARTS HERE//
cout<<" * *\n";
cout<<" ** **\n";
cout<<" *** ***\n";
cout<<" *****************************\n";
cout<<" ***************AIR*************D\n";
cout<<" *****************************\n";
cout<<" ****\n";
cout<<" ***\n";
cout<<" **\n";
cout<<" *\n\n\n";
cout<<"======== Loading.... ========= \n";
cout<<"\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<<endl;
cout << "\t WELCOME TO AIRLINE RESERVATION SYSTEM \n";
cout<<":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<<endl;
cout<<" ..................... MENU OPTIONS .............................\n"<<endl;
menu(); //calling the menu function.
seat_fill(); // initialize seat array.
//
cin.get();
cin.get();
main();
}
else
{
cout<<"\nLOGIN ERROR\nPlease check your username and password\n";
main();
}
}
void registr()
{
string reguser,regpass,ru,rp;
system("cls");
cout<<"Enter the username :";
cin>>reguser;
cout<<"\nEnter the password :";
cin>>regpass;
ofstream reg("database.txt",ios::app);
reg<<reguser<<' '<<regpass<<endl;
system("cls");
cout<<"\nRegistration Sucessful\n";
cout<<"You can login now.\n";
main();
}
void forgot()
{
int ch;
system("cls");
cout<<"Forgotten ? We're here for help\n";
cout<<"1.Search your id by username"<<endl;
cout<<"2.Search your id by password"<<endl;
cout<<"3.Main menu"<<endl;
cout<<"Enter your choice :";
cin>>ch;
switch(ch)
{
case 1:
{
int count=0;
string searchuser,su,sp;
cout<<"\nEnter your remembered username :";
cin>>searchuser;
ifstream searchu("database.txt");
while(searchu>>su>>sp)
{
if(su==searchuser)
{
count=1;
}
}
searchu.close();
if(count==1)
{
cout<<"\n\nHurray, account found\n";
cout<<"\nYour password is "<<sp;
cin.get();
cin.get();
system("cls");
main();
}
else
{
cout<<"\nSorry, Your userID is not found in our database\n";
cout<<"\nPlease kindly contact your system administrator for more details \n";
cin.get();
cin.get();
main();
}
break;
}
case 2:
{
int count=0;
string searchpass,su2,sp2;
cout<<"\nEnter the remembered password :";
cin>>searchpass;
ifstream searchp("database.txt");
while(searchp>>su2>>sp2)
{
if(sp2==searchpass)
{
count=1;
}
}
searchp.close();
if(count==1)
{
cout<<"\nYour password is found in the database \n";
cout<<"\nYour Id is : "<<su2;
cin.get();
cin.get();
system("cls");
main();
}
else
{
cout<<"Sorry, We cannot found your password in our database \n";
cout<<"\nkindly contact your administrator for more information\n";
cin.get();
cin.get();
main();
}
break;
}
case 3:
{
cin.get();
main();
}
default:
cout<<"Sorry, You entered wrong choice. Kindly try again"<<endl;
forgot();
}
}