输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。我写的代码为什么不行啊

#include<stdio.h>
#include <string.h>


int main(){
    
    char str[50];
    int a,b,c,d,i;
    gets(str);
    for(i=0;i<strlen(str);i++){
        
        if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z'){
            a++;
        }
        else if(str[i]==' '){
            b++;
            
        }
        else if(str[i]>='0'&&str[i]<='9')
        c++;
        else
        d++;
    }
    printf("%d %d %d %d",a,b,c,d);
}


a12svs
浏览 864回答 0
0回答

慕斯4360584

OHGVVIMWWXYSOBJZHAXHFSOBVVFNXYLMBYAHPTDLPTAXSLMRYSKRVAENZZNHLSJZNBQJZNRCOVWXHGHHSMTHBJUWSIYZXYMGEQYMZJJHMLOWRDZFFHTGXFARFJZWYWAPTNTDQQKNILZQYTYCTHPWRSGUKWRIJFNUQHFQMHDRLGCKOSUAKVFQVGSQRTAHFUZUQSAMCPSPTVBTKGXZLUSNOWJVQCUIRWECHYQRDITXXWLUAXWLDRPPQYPLHZBYARMQLNSZHWVORMAILPOGUCFBAAORZUYXQLGEHFOLOHGWNYUAWZVKGPVBYRNCMPTFFKGGBNQHIRQCSBEDDCPHTTFGSDQDPCBPBOCUPTMXDKDWQXESBHOQGVYCTWCTJLOSIKBSCVSWCSUNCSJLLMZEUTSHUPQDHKOEUCEGXMEGVLQSVXSWZTVDGJPFHKAROHWMCESJNDHYYKYVSRSITXUSKHOFIFCZXRXGRPOPDTHIZOQGXAUKZPTNBDVAETLTJZHVKAEYBFHXOJKMQFUMCEMCPQXMQTJBDHKNBRVLCFVKSWDESILODTJRHXDUKMCSWMPLJXMPEHKOWMPKYADGVQSHXAOPWLODUJLQSWKZPRGWZOJMKEVNPSILNQGBETWMETIPTWKYCSHMCWZCSTXZQHKSVXBQBQGOFVKNDUXJYAQFVKMUKAINWTEGRLVFDMACFUOQGILDDGVZUWMORHK

慕斯4360584

ZYIFZPWZTQDXEVRZNTLEBOMJSVTNPEIVOWFMZZWVPT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