Untitled
1 month 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);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36