-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.cpp
57 lines (50 loc) · 1.56 KB
/
login.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
class login
{
private:
string acc_no;
string pass;
public:
int check()
{
cout<<"\nAccount number : ";
cin>>acc_no;
cin.ignore();
cout<<"Password : ";
getline(cin,pass);
ifstream fin;
fin.open("login.txt");
string searching="";
string password="";
int flag=0;
while(!fin.eof())
{
getline(fin,searching);
if(searching == acc_no)
{
flag=1;
getline(fin,password);
if(password==pass)
{
cout<<"successful";
break;
}
else
{
system("CLS");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t\t password does not match";
sleep(3);
system("CLS");
return 0;
}
}
}
if(fin && flag==0)
{
system("CLS");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t\t Account Not found";
sleep(3);
system("CLS");
}
return flag;
}
};