为甚么总是输出NO???密码问题
#include<stdio.h>#include<stdlib.h>
#include<string.h>
int main()
{
int n,i;
scanf("%d",&n);
getchar();
while(n--)
{
char a[100];
gets(a);
int l=0,k=0,m=0,p=0,sum=0,t;
t=strlen(a);
if(t<8||t>16)
{
printf("NO\n");
}
else
{
for( i=0;i<t;i++)
{
if(a[i]>='a'&&a[i]<='z') m=1;
else if(a[i]>='0'&&a[i]<=9) k=1;
else if(a[i]<='Z'&&a[i]>='A') l=1;
else if ((a[i]=='@')||(a[i]=='#')||(a[i]=='$')||(a[i]=='%')||(a[i]=='^')||(a[i]=='~')||(a[i]=='!')||(a[i]=='^' )) p=1;
}
sum=m+k+l+p;
if(sum>=3)
{
printf("YES\n");
}
else printf("NO\n");
}
}
return 0;
}