-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.cpp
More file actions
198 lines (198 loc) · 4.71 KB
/
Copy pathAccount.cpp
File metadata and controls
198 lines (198 loc) · 4.71 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
class Account
{
private:
//Actual
string username;
string password;
string place;
string food;
string date;
char ch;
//Testing
string Username;
string Password;
string newP;
string Place;
string Food;
string Date;
char Ch,CH;
public:
void input()
{
cout<<"\n\t\t\tAccount SignUp\n";
while(1)
{
cout<<"\nUsername : ";
cin>>username;
cout<<"\nPassword : ";
cin>>password;
system("cls");
cout<<"\n\t\t\tAccount SignUp\n";
cout<<"\nTo keep your account & data secured in case you forget your password ";
cout<<"\nWe would like to ask some questions ";
break;
}
while(1)
{
cout<<"\n\t\tWould you like to proceed(y/n)";
cin>>ch;
system("cls");
if(ch=='y'||ch=='Y')
{
cout<<"\n\t\t\tAccount SignUp";
cout<<"\nEnter your date of birth(D/M/Y) : ";
cin>>date;
cout<<"\nEnter your favorite place : ";
cin>>place;
cout<<"\nEnter your favorite food : ";
cin>>food;
}
else if(ch=='n'||ch=='N')
{
food=" ";
date=" ";
place=" ";
}
else
continue;
break;
}
}
int Signin()
{
system("cls");
cout<<"\n\t\t\tSignin";
int count=0;
char check;
while(1)
{
cout<<"\nUsername : ";
cin>>Username;
if(Username!=username)
{
PlaySound(TEXT("C:/Users/PC/Downloads/User.wav"),NULL,SND_FILENAME | SND_SYNC);
cout<<"\nUser not found.";
continue;
}
while(1)
{
if(username=="0" || password=="0")
break;
cout<<"\nPassword : ";
cin>>Password;
if(password!=Password)
{
PlaySound(TEXT("C:/Users/PC/Downloads/Denied.wav"),NULL,SND_FILENAME | SND_SYNC);
cout<<"\nWrong Password.";
count++;
if(count>=3)
{
cout<<"\n\t\t\tForgot Password?(y/n)";
cin>>check;
}
if(check=='y' || check=='Y')
{
Forgot();
if(username=="0"&&password=="0"&&food=="0")
return 0;
continue;
}
continue;
}
break;
}
PlaySound(TEXT("C:/Users/PC/Downloads/Access.wav"),NULL,SND_FILENAME | SND_SYNC);
system("cls");
return 1;
}
}
void Forgot()
{
system("cls");
if(food==" " && date==" " && place==" ")
{
PlaySound(TEXT("C:/Users/PC/Downloads/User.wav"),NULL,SND_FILENAME | SND_SYNC);
cout<<"\n\t\tSorry you didn't provide us with the information while creating this account .";
cout<<"\n\t\tTherefore , we can't help you .";
}
else
{
while(1)
{
cout<<"\nEnter your date of birth(D/M/Y) : ";
cin>>Date;
cout<<"\nEnter your favorite place : ";
cin>>Place;
cout<<"\nEnter your favorite food : ";
cin>>Food;
if(food==Food && date==Date && place==Place)
{
Change();
break;
}
else
{
PlaySound(TEXT("C:/Users/PC/Downloads/User.wav"),NULL,SND_FILENAME | SND_SYNC);
cout<<"\n\t\tPrivate information doesn't match.Try Again.";
continue;
}
}
}
}
void Change()
{
int x;
while(1)
{
system("cls");
cout<<"\n\t\t\t1.View Password ";
cout<<"\n\t\t\t2.Change Password";
cout<<"\n\t\t\t3.Delete Account";
cout<<"\n\t\t\tChoose from (1-3) ";
cout<<"\nReturn(R)";
cout<<"\n\t\tYou choose:";
cin>>Ch;
switch(Ch)
{
case '1':
system("cls");
cout<<"\n\tYour password is "<<password<<" !";
system("pause");
break;
case '2':
system("cls");
cout<<"\nNew password : ";
cin>>newP;
password=newP;
cout<<"\n\t\tYour password has been changed !";
system("pause");
break;
case '3':
system("cls");
cout<<"\n\t\tAre you sure you want to delete your account(y/n)?";
cin>>CH;
if(CH=='y' || CH=='Y')
{
username="0";
password="0";
place="0";
food="0";
date="0";
x=1;
cout<<"\n\t\tYour Account has been deleted !";
system("pause");
}
break;
case 'R':
case 'r':
x=1;
break;
default:
PlaySound(TEXT("C:/Users/PC/Downloads/User.wav"),NULL,SND_FILENAME | SND_SYNC);
cout<<"\n\t\t\tInvalid command";
break;
}
if(x==1)
break;
}
}};