-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
265 lines (233 loc) · 7.15 KB
/
main.cpp
File metadata and controls
265 lines (233 loc) · 7.15 KB
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
///To get better visual performance make sure the console screen size is (112*30)
#include "main.h"
using namespace std;
using namespace winEdit;
int main(int argc,char *argv[])
{
//initialize section
system("mkdir files\\customers\\pass");
system("cls");
resizeConsole();
{
ifstream fin("files\\upDown.dat");
if(!fin.is_open())
takeUpDown();
else
fin.close();
}
//password section
string password,realPassword;
int i,chosenId;
ifstream pin("files\\customers\\pass\\password.dat");
if(pin.is_open())
{
getline(pin,realPassword);
pin.close();
}
else
{
ofstream pout("files\\customers\\pass\\password.dat");
string dummy="0";
realPassword=dummy;
pout<<realPassword;
pout.close();
}
for(;;)
{
system("cls");
cout<<endl<<setw(13)<<" "<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(14)<<" ";
cout<<"Enter the authentication password to access the data base "<<setw(10)<<" "<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(28)<<" "<<"PASSWORD: "<<setw(45)<<" "<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"-"<<setw(84)<<"-"
<<endl<<setw(13)<<" "<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
gotoxy(PASS_START_X,PASS_START_Y);
cin.sync();
password.clear();
for(i=0; i<20; i++)
{
char temp=getch();
if(temp==10||temp==13)
{
break;
}
else if(temp==8)
{
if(i==0)
{
i--;
continue;
}
password.erase(password.end()-1);
cout<<"\b \b"<<flush;
i-=2;
continue;
}
password.push_back(temp);
cout<<"*";
}
if(password!=realPassword)
{
int indicate=0;
indicate=MessageBoxA(NULL,"Wrong password.","NOTE",5|MB_ICONEXCLAMATION);
if(indicate!=4)
{
gotoxy(0,20);
getch();
return 0;
}
}
else
{
MessageBoxA(NULL,"Welcome,Press enter to continue.","NOTE",MB_DEFAULT_DESKTOP_ONLY);
break;
}
}
gotoxy(53,27);
cout<<"LOADING"<<endl;
int printer;
cout<<setw(6)<<" ";
for(printer=0; printer<100; printer++)
cout<<"_";
CONSOLE_SCREEN_BUFFER_INFO cursor;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor);
gotoxy(0,cursor.dwCursorPosition.Y);
cout<<setw(6)<<" ";
for(printer=0; printer<20; printer++)
{
char a=-37;
for(int i=0; i<5; i++)
cout<<a;
Sleep(5);
}
Sleep(100);
while(true)
{
string ind="* ";
int choice=1;
string currentTime;
while(true)
{
system("cls");
display(MAIN MENU);
cout<<"Please choose a option below:-"<<endl
<<"["<<ind[0]<<"] 1. Find an account."<<endl
<<"["<<ind[1]<<"] 2. Create a new account."<<endl
<<"["<<ind[2]<<"] 3. Update information of an existing account."<<endl
<<"["<<ind[3]<<"] 4. Delete an account."<<endl
<<"["<<ind[4]<<"] 5. View details."<<endl
<<"["<<ind[5]<<"] 6. Exit."<<endl;
string check,pressedUp,pressedDown,pressedEnter;
ifstream fin("files\\upDown.dat");
fin>>pressedUp>>pressedDown;
fin.close();
//cin.ignore(100);
cin.sync();
check.push_back(getch());
while(kbhit())
{
check.push_back(getch());
}
//taking button pressed;
if(check==pressedUp)
{
if(choice==1)
{
ind[5]='*';
ind[0]=' ';
choice=6;
}
else
{
ind[choice-2]='*';
ind[choice-1]=' ';
choice--;
}
}
else if(check==pressedDown)
{
if(choice==6)
{
ind[0]='*';
ind[5]=' ';
choice=1;
}
else
{
ind[choice]='*';
ind[choice-1]=' ';
choice++;
}
}
else if(check[0]==13)
break;
}
Options *bptr;
New nOb;
View vOb;
Search sOb;
Delete dOb;
Update uOb;
if(choice==1)
{
bptr=&sOb;
chosenId=bptr->choice();
if(chosenId!=-1)
{
cout<<"What do you want to do with this account?"<<endl
<<endl<<"1. Delete it."<<endl
<<endl<<"2. Update account information."<<endl
<<endl<<"3. View detailed information."<<endl
<<endl<<"4. Abort. "<<endl
<<endl<<"INPUT : ";
int choice;
cin>>choice;
while(choice!=1 && choice!=2 && choice!=3 && choice!=4)
{
cout<<"Invalid selection !! Try again : ";
cin>>choice;
}
if(choice==1)
{
bptr=&dOb;
}
else if(choice==2)
{
bptr=&uOb;
}
else if(choice==3)
{
bptr=&vOb;
}
else
{
cout<<"Aborted !!"<<endl;
}
bptr->choice(chosenId);
}
}
else if(choice==2)
bptr=&nOb;
else if(choice==3)
bptr=&uOb;
else if(choice==4)
bptr=&dOb;
else if(choice==5)
bptr=&vOb;
else
break;
if(choice!=1)
bptr->choice();
cout<<endl<<"--Press \"Enter\" key to go to main menu.\n";
getch();
}
return 0;
}