Guest User

Untitled

a guest
Nov 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. int addUser(Account &a)
  2. {
  3. vector<Account>::iterator it;
  4. if (it == info.begin() && it == info.end())
  5. {
  6. if (a._password.size() < 8)
  7. {
  8. cout << "Registration failed" << endl;
  9. return 0;
  10. }
  11. else { info.push_back(a); }
  12. }
  13. else
  14. {
  15. for (it = info.begin(); it != info.end(); ++it)
  16. {
  17. if (a._login == it->_login)
  18. {
  19. cout << "Registration failed" << endl;
  20. return 0;
  21. }
  22. if (a._password.size() < 8)
  23. {
  24. cout << "Registration failed" << endl;
  25. return 0;
  26. }
  27. else { info.push_back(a); }
  28. cout << "Hello" << endl;
  29. }
  30. }
  31. cout << "Successfully added!" << endl;
  32. }
  33.  
  34. int authorize(Account &a)
  35. {
  36. vector<Account>::iterator it;
  37. bool accept;
  38. accept = false;
  39. for (it = info.begin(); it != info.end(); ++it)
  40. {
  41. cout << "Hello" << endl;
  42. if (a._login == it->_login)
  43. if (a._password == it->_password)
  44. {
  45. accept = true;
  46. return 0;
  47. }
  48. else { accept = false; }
  49. }
  50. if (accept)
  51. {
  52. cout << "Online" << endl;
  53. return 0;
  54. }
  55. else { cout << "Authorization failed" << endl; }
  56. return 1;
  57. }
Add Comment
Please, Sign In to add comment