Advertisement
Guest User

Untitled

a guest
May 16th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #include <iostream> // library that contains basic input output functions
  2. #include <string> // library for c++ strings
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     //Username and Password to validate credentials
  9.     const string USERNAME = "ali";
  10.     const string USERNAME2 = "Shahab";
  11.     const string PASSWORD2 = "14567";
  12.     const string PASSWORD = "564";
  13.     string username, password;
  14.  
  15.     cout << "Enter Username : ";
  16.     cin >> username;
  17.  
  18.     cout << "Enter Password : ";
  19.     cin >> password;
  20.        
  21.             //Checking if user's entered credentials are equal to actual USERNAME and PASSWORD
  22.             if (username == USERNAME && password == PASSWORD)
  23.             {
  24.                 cout << "User credentials are correct!!!" << endl;
  25.                 cin.get();
  26.             }
  27.             else
  28.             {
  29.                 if (username == USERNAME2 && password == PASSWORD2)
  30.                 {
  31.                     cout << "User credentials are correct!!!" << endl;
  32.                     cin.get();
  33.                 }
  34.                 else
  35.                 {
  36.                     cout << "Invalid login details" << endl;
  37.                     cin.get();
  38.                 }
  39.             }
  40.             cin.get();
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement