Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- while (loginAttempt < 3)
- {
- cout << "Please enter your user name: ";
- cin >> sUsername;
- cout << "\nPlease enter your user password: ";
- cin >> sPassword;
- if (sUsername == "william" && sPassword == "password")
- {
- cout << "\n\nWelcome " << sUsername << "!\n";
- break;
- }
- else if (sUsername == "ryan" && sPassword == "password")
- {
- cout << "\n\nWelcome " << sUsername << "!\n";
- break;
- }
- else
- {
- cout << "\n\nInvalid login attempt, please try again\n" << '\n';
- loginAttempt++;
- }
- }
- if (loginAttempt == 3)
- {
- cout << "\n\nInvalid, too many login attempts!\n";
- return 0;
- }
- cout << "\nThank you for logging in\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement