Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool validateUser(string theAccounts[][COLS], string username, string password, int &saveRow)
- {
- cout << "Please enter the following information or 0 to exit" << endl;
- cout << "Please enter your username > ";
- cin >> username;
- cout << "Please enter your password > ";
- cin >> password;
- if (theAccounts[0][0] == username && theAccounts[0][3] == password) //username 1
- {
- saveRow = 0; return true;
- }
- if (password != theAccounts[0][3])
- {
- cout << "Please enter the following information or 0 to exit" << endl;
- cout << "Please enter your username > ";
- cin >> username;
- cout << "Please enter your password > ";
- cin >> password;
- }
- if (theAccounts[1][0] == username && theAccounts[1][3] == password) //username 2
- {
- saveRow = 1; return true;
- }
- if (password != theAccounts[1][3])
- {
- cout << "Please enter the following information or 0 to exit" << endl;
- cout << "Please enter your username > ";
- cin >> username;
- cout << "Please enter your password > ";
- cin >> password;
- }
- if (theAccounts[2][0] == username && theAccounts[2][3] == password) //username 3
- {
- saveRow = 2; return true;
- }
- if (password != theAccounts[2][3])
- {
- cout << "Please enter the following information or 0 to exit" << endl;
- cout << "Please enter your username > ";
- cin >> username;
- cout << "Please enter your password > ";
- cin >> password;
- }
- if (theAccounts[3][0] == username && theAccounts[3][3] == password) //username 4
- {
- saveRow = 3; return true;
- }
- if (password != theAccounts[3][3])
- {
- cout << "Please enter the following information or 0 to exit" << endl;
- cout << "Please enter your username > ";
- cin >> username;
- cout << "Please enter your password > ";
- cin >> password;
- }
- if (theAccounts[4][0] == username && theAccounts[4][3] == password) //username 5
- {
- saveRow = 4; return true;
- }
- if (password != theAccounts[4][3])
- {
- cout << "Please enter the following information or 0 to exit" << endl;
- cout << "Please enter your username > ";
- cin >> username;
- cout << "Please enter your password > ";
- cin >> password;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement