SHARE
TWEET

Untitled

a guest Sep 1st, 2012 34 Never
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. int main();
  8.  
  9. bool strget(char password)
  10. {
  11.     char Local[10] = "AP4ssW0rD";
  12.  
  13.     if(password == *Local) {
  14.         return true;
  15.     } else {
  16.         return false;
  17.     }
  18. }
  19.  
  20.  
  21. int main()
  22. {
  23.     int Attempts = 1;
  24.     char entered[10];
  25.     cout << endl << "Password: ";
  26.     cin >> entered;
  27.  
  28.     while(Attempts != 3) {
  29.         if(strget(*entered)) {
  30.             cout << "Welcome to the CIA...\n\n";
  31.             break;
  32.         } else {
  33.             cout << "Failure" << endl;
  34.             cout << endl << "Attempts: " << Attempts << " out of 3" << endl << "Password: ";
  35.             cin >> entered;
  36.         }
  37.         Attempts++;
  38.     }
  39.     cin.ignore();
  40.     cin.get();
  41.     return 0;
  42. }
RAW Paste Data
Top