Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int addUser(Account &a)
- {
- vector<Account>::iterator it;
- if (it == info.begin() && it == info.end())
- {
- if (a._password.size() < 8)
- {
- cout << "Registration failed" << endl;
- return 0;
- }
- else { info.push_back(a); }
- }
- else
- {
- for (it = info.begin(); it != info.end(); ++it)
- {
- if (a._login == it->_login)
- {
- cout << "Registration failed" << endl;
- return 0;
- }
- if (a._password.size() < 8)
- {
- cout << "Registration failed" << endl;
- return 0;
- }
- else { info.push_back(a); }
- cout << "Hello" << endl;
- }
- }
- cout << "Successfully added!" << endl;
- }
- int authorize(Account &a)
- {
- vector<Account>::iterator it;
- bool accept;
- accept = false;
- for (it = info.begin(); it != info.end(); ++it)
- {
- cout << "Hello" << endl;
- if (a._login == it->_login)
- if (a._password == it->_password)
- {
- accept = true;
- return 0;
- }
- else { accept = false; }
- }
- if (accept)
- {
- cout << "Online" << endl;
- return 0;
- }
- else { cout << "Authorization failed" << endl; }
- return 1;
- }
Add Comment
Please, Sign In to add comment