Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. bool validateUser(string theAccounts[][COLS], string username, string password, int &saveRow)
  2. {
  3.  
  4. cout << "Please enter the following information or 0 to exit" << endl;
  5. cout << "Please enter your username > ";
  6. cin >> username;
  7. cout << "Please enter your password > ";
  8. cin >> password;
  9.  
  10.  
  11. if (theAccounts[0][0] == username && theAccounts[0][3] == password) //username 1
  12. {
  13. saveRow = 0; return true;
  14. }
  15. if (password != theAccounts[0][3])
  16. {
  17. cout << "Please enter the following information or 0 to exit" << endl;
  18. cout << "Please enter your username > ";
  19. cin >> username;
  20. cout << "Please enter your password > ";
  21. cin >> password;
  22. }
  23. if (theAccounts[1][0] == username && theAccounts[1][3] == password) //username 2
  24. {
  25. saveRow = 1; return true;
  26. }
  27. if (password != theAccounts[1][3])
  28. {
  29. cout << "Please enter the following information or 0 to exit" << endl;
  30. cout << "Please enter your username > ";
  31. cin >> username;
  32. cout << "Please enter your password > ";
  33. cin >> password;
  34. }
  35. if (theAccounts[2][0] == username && theAccounts[2][3] == password) //username 3
  36. {
  37. saveRow = 2; return true;
  38. }
  39. if (password != theAccounts[2][3])
  40. {
  41. cout << "Please enter the following information or 0 to exit" << endl;
  42. cout << "Please enter your username > ";
  43. cin >> username;
  44. cout << "Please enter your password > ";
  45. cin >> password;
  46. }
  47. if (theAccounts[3][0] == username && theAccounts[3][3] == password) //username 4
  48. {
  49. saveRow = 3; return true;
  50. }
  51. if (password != theAccounts[3][3])
  52. {
  53. cout << "Please enter the following information or 0 to exit" << endl;
  54. cout << "Please enter your username > ";
  55. cin >> username;
  56. cout << "Please enter your password > ";
  57. cin >> password;
  58. }
  59. if (theAccounts[4][0] == username && theAccounts[4][3] == password) //username 5
  60. {
  61. saveRow = 4; return true;
  62. }
  63. if (password != theAccounts[4][3])
  64. {
  65. cout << "Please enter the following information or 0 to exit" << endl;
  66. cout << "Please enter your username > ";
  67. cin >> username;
  68. cout << "Please enter your password > ";
  69. cin >> password;
  70. }
  71.  
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement