8.11.3 统计大小写字符个数

8.11.3.c

include <stdio.h>

include <ctype.h>

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;
}

posted on 2019-05-20 20:35  viviLy  阅读(184)  评论(0)    收藏  举报