Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. bool isValidPassword(std::string pass)
  2. {
  3. string s="!@#$^&*()";
  4. if(sizeof(pass)<6 || sizeof(pass)>12)
  5. return false;
  6. int x=0, y=0, z=0, t=0;
  7. int i=0;
  8.  
  9. for(i=0; i<sizeof(pass); i++)
  10. {
  11. int a=0;
  12. if(pass[i]>='a' && pass[i]<='z')
  13. {
  14. x++;
  15. a=1;
  16. }
  17. else if(pass[i]>='A' && pass[i]<='z')
  18. {
  19. y++;
  20. a=1;
  21. }
  22. else if(pass[i]>='0' && pass[i]<='9')
  23. {
  24. t++;
  25. a=1;
  26. }
  27. else if(a!=1){
  28. for(int j=0; j<9; j++)
  29. {
  30. if(s[j]==s[i])
  31. z++;
  32. }
  33. }
  34. else return false;
  35.  
  36. }
  37. if(x<1 || x>4 || y<1 || y>4 || t<1 || t>4 || z!=1)
  38. return false;
  39. else
  40. return true;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement