检查设定的密码,高采纳率

本人是新手,代码非常易懂,求大佬指点代码在最后

img

img


break已经改成continue了

img


#include<stdio.h>
#include<string.h>
int main(){
    int N, j, k, len;
    char a[81];
    scanf("%d", &N);
    getchar();
    for(k = 0; k < N; k++){
        int digit = 0, letter = 0, spot = 0;
        gets(a);
        len = strlen(a);
        if(len < 6){
            printf("Your password is tai duan le.\n");
            continue;
        }else{
            for(j = 0; a[j]; j++){
                if((a[j] >= 'a' && a[j] <= 'z') || (a[j] >= 'A' && a[j] <= 'Z'))
                    letter++;
                else if(a[j] >= '0' && a[j] <= '9')
                    digit++;
                else if(a[j] == '.')
                    spot++;
            }
            if(letter + digit + spot != len)
                printf("Your password is tai luan le.\n");
            else if(digit == 0 && letter != 0)
                printf("Your password needs shu zi.\n");
            else if(digit != 0 && letter == 0)
                printf("Your password needs zi mu.\n");
            else
                printf("Your password is wan mei.\n");
        }
    }
    return 0;
}

b c d e 在判断完一行密码后,没有复位,会把上一次的结果带到下一次判断里。
第20行开始到36行间,判断的条件及各符号的计数都有问题,计数只等于1,岂不是
只要对应的字符出现一次就可以了,别的字符难道仅仅就是一个'*'需要判断?数字
就是 a[i]>='0' && a[i]<='0' ?

if(a[i] > 'b' || a[i] <= 'b')
????
你这个判断有啥意义?不都是真?