Advertisement
Guest User

Untitled

a guest
Mar 16th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. {
  2. while (loginAttempt < 3)
  3. {
  4. cout << "Please enter your user name: ";
  5. cin >> sUsername;
  6. cout << "\nPlease enter your user password: ";
  7. cin >> sPassword;
  8.  
  9. if (sUsername == "william" && sPassword == "password")
  10. {
  11. cout << "\n\nWelcome " << sUsername << "!\n";
  12. break;
  13. }
  14. else if (sUsername == "ryan" && sPassword == "password")
  15. {
  16. cout << "\n\nWelcome " << sUsername << "!\n";
  17. break;
  18. }
  19. else
  20. {
  21. cout << "\n\nInvalid login attempt, please try again\n" << '\n';
  22. loginAttempt++;
  23. }
  24. }
  25. if (loginAttempt == 3)
  26. {
  27. cout << "\n\nInvalid, too many login attempts!\n";
  28. return 0;
  29. }
  30.  
  31. cout << "\nThank you for logging in\n";
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement