8.11.3 统计大小写字符个数

1608836-20190520203256212-594093118.png

# 8.11.3.c
#include 
#include 
int main(void)
{
    char ch;
    int upper = 0, lower = 0, total = 0;

    while ((ch = getchar()) != EOF)
    {
        ++total;
        if (islower(ch) > 0)
            ++lower;
        else if (isupper(ch) > 0)
            ++upper;
    }

    printf("大写字母%d个,小写字母%d个,共%d个字符\n", upper, lower, total);
    return 0;
}

1608836-20190520203434040-1666242684.png

转载于:https://www.cnblogs.com/EisNULL/p/10896304.html

你可能感兴趣的:(8.11.3 统计大小写字符个数)