fojtasd

Untitled

Dec 17th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string heslo;
  9.     cin >> heslo;
  10.     bool small = false, big = false, number = false, character = false;
  11.  
  12.     if (heslo.length() <= 5)
  13.     {
  14.         cout << "Heslo nesplnuje pozadavky." << endl;
  15.         return 0;
  16.     }
  17.  
  18.     for (unsigned int i = 0; i < heslo.length(); i++)
  19.     {
  20.    
  21.             if (heslo[i] >= 'a' and heslo[i] <= 'z')
  22.             {
  23.                 small = true;
  24.             }
  25.    
  26.             if (heslo[i] >= 'A' and heslo[i] <= 'Z')
  27.             {
  28.                 big = true;
  29.             }
  30.            
  31.             if (heslo[i] >= 48 and heslo[i] <= 57)
  32.             {
  33.                 number = true;
  34.             }
  35.        
  36.             if ((heslo[i] >= 33 and heslo[i] <= 47) or (heslo[i] >= 58 and heslo[i] <= 64))
  37.             {
  38.                 character = true;
  39.             }
  40.  
  41.     }
  42.  
  43.     if ((small == true or big == true) and (character == true) and (number == true))
  44.     {
  45.         cout << "Heslo splnuje pozadavky." << endl;
  46.         return 0;
  47.     }
  48.     else cout << "Heslo nesplnuje pozadavky." << endl;
  49.  
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment