Advertisement
Guest User

LoginWorking

a guest
Dec 28th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class LoginManager
  5. {
  6. public:
  7.  
  8. string PasswordAttempt1;
  9. string PasswordAttempt2;
  10. string PasswordAttempt3;
  11. string UsernameAttempt;
  12. LoginManager()
  13. {
  14. accessGranted = 0;
  15. }
  16. void Login()
  17. {
  18. USERNAME:
  19. cout<<"Please enter your Username and Password"<<endl;
  20. cout<<"Username: ";
  21. cin>>UsernameAttempt;
  22. if (UsernameAttempt==Username1)
  23. {
  24. goto Login1;
  25. }
  26. if (UsernameAttempt==Username2)
  27. {
  28. goto Login2;
  29. }
  30. if (UsernameAttempt==Username3)
  31. {
  32. goto Login3;
  33. }
  34.  
  35. Login1:
  36. system ("clear");
  37. cout<<"Username: johnmichaelnebre"<<endl;
  38. cout<<"Password: ";
  39. cin>>PasswordAttempt1;
  40. if (PasswordAttempt1==Password1)
  41. {
  42. system ("clear");
  43. cout<<"Welcome to LaShoppee Mr.johnmichaelnebre"<<endl;
  44. goto Successful;
  45. }
  46. else
  47. {
  48. cout<<"Password does not match, Please try again"<<endl;
  49. goto Login1;
  50. }
  51.  
  52. Login2:
  53. system ("clear");
  54. cout<<"Username: briancaguisa"<<endl;
  55. cout<<"Password: ";
  56. cin>>PasswordAttempt2;
  57. if (PasswordAttempt2==Password2)
  58. {
  59. system ("clear");
  60. cout<<"Welcome to LaShoppee Mr.briancaguisa"<<endl;
  61. goto Successful;
  62. }
  63. else
  64. {
  65. cout<<"Password does not match, Please try again"<<endl;
  66. goto Login2;
  67. }
  68.  
  69. Login3:
  70. system ("clear");
  71. cout<<"Username: rosacuevas"<<endl;
  72. cout<<"Password: ";
  73. cin>>PasswordAttempt3;
  74. if (PasswordAttempt3==Password3)
  75. {
  76. system ("clear");
  77. cout<<"Welcome to LaShoppee Ms.rosacuevas"<<endl;
  78. goto Successful;
  79. }
  80. else
  81. {
  82. cout<<"Password does not match, Please try again"<<endl;
  83. goto Login3;
  84. }
  85.  
  86. Successful:
  87. cout<<"\t\t _________________________________"<<endl;
  88. cout<<"\t\t| |"<<endl;
  89. cout<<"\t\t| Welcome to LaShoppee |"<<endl;
  90. cout<<"\t\t|_________________________________|"<<endl;
  91. cout<<"\t\t| |"<<endl;
  92. cout<<"\t\t| 1. Shop Now!! |"<<endl;
  93. cout<<"\t\t| 2. Whats This? |"<<endl;
  94. cout<<"\t\t| 3. Exit |"<<endl;
  95. cout<<"\t\t|_________________________________|"<<endl;
  96. cout<<"\t\t Enter your choice: ";
  97.  
  98. }
  99.  
  100. private:
  101. string Password1 = "1234";
  102. string Password2 = "5678";
  103. string Password3 = "9012";
  104. string Username1 = "johnmichaelnebre";
  105. string Username2 = "briancaguisa";
  106. string Username3 = "rosacuevas";
  107. bool accessGranted;
  108.  
  109. };
  110.  
  111. int main()
  112. {
  113. LoginManager LoginManagerObj;
  114. LoginManagerObj.Login();
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement