Untitled
4 years ago in Plain Text
void check_pass(char pass[100])
{
int i;
for (i=0;i<strlen(pass);i++)
{
if (strlen(pass)<6)
{
printf ("Your password is too short.\n");
break;
}
else if (pass[i]>='A' && pass[i]<='Z')
{
printf ("You password has to contain at least one lowercase letter.");
break;
}
else if (pass[i]>='a' && pass[i]<='z')
{
printf ("Your password has to contain at least one uppercase letter.");
break;
}
else if (pass[i]>=!'0' && pass[i]<=!'10')
{
printf ("Your password has to contain at least one number.");
break;
}
}
}
int main ()
{
char password[100];
printf ("Enter a password:\n");
gets(password);
check_pass(password);
}