Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auto l = make_unique<loginfo>();//instantiate structure for user info
- fstream in;
- in.open(userDB, ios::in | ios::binary);//open the text file contains info
- cout << "id:";
- cin >> id;
- while (in>>l->id>>l->pwd)//read user info from text file
- {
- //to check id's correct or not
- if (l->id == id)//id match
- {
- pwd = setpass("password:”) ;//password masking
- if (l->pwd == pwd)//password match
- cout << "user verified!" << endl;
- else //password mismatch
- {
- cout << "incorrect password." << endl;
- pwd = setpass("password:");//pwd reinput
- }
- break;
- }
- else
- {
- cout << "incorrect id" << endl;
- }
- }
- break;
- auto l = make_unique<loginfo>();
- fstream in;
- in.open(userDB, ios::in | ios::binary);
- cout << "id:";
- cin >> id;
- while (in >> l->id >> l->pwd)
- {
- if (l->id == id)
- cout << l->id << " " << l->pwd << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement