c语言编程练习题:7-64 统计大写辅音字母
作者:yunjinqi   类别:    日期:2023-05-29 21:50:57    阅读:118 次   消耗积分:0 分    

image.png

#include <stdio.h>
int main(){
    char consonant[21]={'B','C','D','F','G','H','J','K','L','M','N','P','Q','R','S','T','V','W','X','Y','Z'};
    char result[81];
    int i=0;
    int count=0;
    char c;
    while (i < 80 && scanf("%c", &c) == 1 && c != '\n') {
        result[i++] = c;
    }
    for (int k=0;k<i;k++){
        for (int j=0;j<21;j++){
            if (result[k] == consonant[j]){count++;break;}
        }
    }
    printf("%d",count);
    return 0;
}


版权所有,转载本站文章请注明出处:云子量化, http://www.woniunote.com/article/189
上一篇:c语言编程练习题:7-63 高空坠球
下一篇:c语言编程练习题:7-65 字符串替换