Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isValidPassword(std::string pass)
- {
- string s="!@#$^&*()";
- if(sizeof(pass)<6 || sizeof(pass)>12)
- return false;
- int x=0, y=0, z=0, t=0;
- int i=0;
- for(i=0; i<sizeof(pass); i++)
- {
- int a=0;
- if(pass[i]>='a' && pass[i]<='z')
- {
- x++;
- a=1;
- }
- else if(pass[i]>='A' && pass[i]<='z')
- {
- y++;
- a=1;
- }
- else if(pass[i]>='0' && pass[i]<='9')
- {
- t++;
- a=1;
- }
- else if(a!=1){
- for(int j=0; j<9; j++)
- {
- if(s[j]==s[i])
- z++;
- }
- }
- else return false;
- }
- if(x<1 || x>4 || y<1 || y>4 || t<1 || t>4 || z!=1)
- return false;
- else
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement