Created
August 29, 2015 20:32
-
-
Save shemul/ecd496ecfa17c103e554 to your computer and use it in GitHub Desktop.
password_problem_in_prokriya.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| #include<stdlib.h> | |
| using namespace std; | |
| using namespace std; | |
| int main() | |
| { | |
| char password[100] ; | |
| gets(password); | |
| char test = password[0]; | |
| int passCount = 0; | |
| int fpassCount = 0; | |
| bool upper = false , digit = false , lower = false ; | |
| bool uC = true , dC= true , lC= true; | |
| for(int i = 0 ; i < strlen(password) + 1 ; i++) | |
| { | |
| if(passCount == 3) { | |
| //cout <<"Ekber" << endl; | |
| fpassCount = fpassCount + 1 ; | |
| upper = false; | |
| digit = false ; | |
| lower = false; | |
| uC = true ; | |
| dC = true; | |
| lC = true; | |
| passCount = 0 ; | |
| } | |
| if(isupper(password[i])) { | |
| // cout <<"upper" ; | |
| upper = true; | |
| if(upper && uC) { | |
| uC = false ; | |
| passCount = passCount + 1; | |
| } | |
| } else if(isdigit(password[i])) { | |
| //cout <<"digit" << endl; | |
| digit = true; | |
| if(digit && dC){ | |
| dC = false; | |
| passCount = passCount + 1; | |
| } | |
| } else if(!isupper(password[i]) && passCount!=3 ) { | |
| // cout <<"lower" << endl; | |
| lower = true; | |
| if(lower && lC){ | |
| lC= false; | |
| passCount = passCount + 1; | |
| } | |
| } | |
| } | |
| //cout << passCount <<endl; | |
| cout <<fpassCount; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment