A password is good if it has at least one digit,one alphanumeric charecter, one uppercase letter, one ordinary lowercase letter letter and consists of 8 charecters or more. I created this program, but I'm not getting correct results.. What is the problem?
void main()
{
cout<<"This program checks whether the password entered by the user is good or not"<<endl;
cout<<"Enter the password"<<endl;
char password[100];
int atleastoneDigit=0,atleastoneLowercaseletter=0,atleastoneUppercaseletter=0,atleastonealphanumericCharecter=0;
cin>>password;
int length=strlen(password);
for(int i=0;i<length;i++)
{
if(password[i]>=33&&password[i]<=58)//ASCII values for uppercase letters
atleastoneUppercaseletter++;
else if(password[i]>=65&&password[i]<=90)
atleastoneLowercaseletter++;
else if(password[i]>=16&&password[i]<=25)
atleastoneDigit++;
else
atleastonealphanumericCharecter++;
}
if(length>=8&&atleastoneDigit!=0&&atleastoneUppercaseletter!=0&&atleastoneLowercaseletter!=0&&atleastonealphanumericCharecter!=0)
cout<<"This is a good password!"<<endl;
else
cout<<"This is not a good password!"<<endl;
}