Advertisement
ivanwidyan

Multiple Username Verification Each With Their Own Password

Oct 16th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.     string username, password;
  7.  
  8.     cout << "Enter your username: ";
  9.     getline(cin, username, '\n');
  10.  
  11.     cout << "Enter your password: ";
  12.     getline(cin, password, '\n');
  13.  
  14.     if (username == "cat" && password == "fish" || username == "dog" && password == "bone") {
  15.         cout << "Access allowed" << endl;
  16.     }
  17.     else {
  18.         cout << "Denied access, One or both your username and password are wrong!" << endl;
  19.         return 0;
  20.     }
  21.     cout << "Hello " << username << "!\n"; 
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement