home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / source / chapter02 / designers_network.cpp next >
Encoding:
C/C++ Source or Header  |  2003-10-21  |  867 b   |  49 lines

  1. // Designers Network
  2. // Demonstrates logical operators
  3.  
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. int main() 
  9. {
  10.     cout << "\tGame Designer's Network\n";
  11.     int security = 0;
  12.  
  13.     string username;
  14.     cout << "\nUsername: ";
  15.     cin >> username; 
  16.  
  17.     string password;
  18.     cout << "Password: ";
  19.     cin >> password; 
  20.  
  21.     if (username == "S.Meier" && password == "civilization")
  22.     {
  23.         cout << "\nHey, Sid.";
  24.         security = 5;
  25.     }
  26.  
  27.     if (username == "S.Miyamoto" && password == "mariobros")
  28.     {
  29.         cout << "\nWhat's up, Shigeru?";
  30.         security = 5;
  31.     }
  32.  
  33.     if (username == "W.Wright" && password == "thesims")
  34.     {
  35.         cout << "\nHow goes it, Will?";
  36.         security = 5;
  37.     }
  38.  
  39.     if (username == "guest" || password == "guest")
  40.     {
  41.         cout << "\nWelcome, guest.";
  42.         security = 1;
  43.     }
  44.  
  45.     if (!security)
  46.         cout << "\nYour login failed.";
  47.  
  48.     return 0;
  49. }