Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. auto l = make_unique<loginfo>();//instantiate structure for user info
  2. fstream in;
  3. in.open(userDB, ios::in | ios::binary);//open the text file contains info
  4.  
  5. cout << "id:";
  6. cin >> id;
  7.  
  8. while (in>>l->id>>l->pwd)//read user info from text file
  9. {
  10. //to check id's correct or not
  11. if (l->id == id)//id match
  12. {
  13. pwd = setpass("password:”) ;//password masking
  14. if (l->pwd == pwd)//password match
  15. cout << "user verified!" << endl;
  16. else //password mismatch
  17. {
  18. cout << "incorrect password." << endl;
  19. pwd = setpass("password:");//pwd reinput
  20. }
  21. break;
  22. }
  23. else
  24. {
  25. cout << "incorrect id" << endl;
  26. }
  27. }
  28. break;
  29.  
  30. auto l = make_unique<loginfo>();
  31. fstream in;
  32. in.open(userDB, ios::in | ios::binary);
  33.  
  34. cout << "id:";
  35. cin >> id;
  36.  
  37. while (in >> l->id >> l->pwd)
  38. {
  39. if (l->id == id)
  40. cout << l->id << " " << l->pwd << endl;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement