Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int PasswordAttempts = 3;
- string Password;
- while (PasswordAttempts >= 0) {
- cout << "Enter your password: ";
- cin >> Password;
- if (Password == "test") {
- cout << "You granted an access!" << endl;
- return 0;
- }
- else
- {
- cout << "Wrong, password! you have " << PasswordAttempts << " try attempts" << endl;
- PasswordAttempts--;
- }
- }
- cout << "You've tried too many attempts, you're blocked" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement