码迷,mamicode.com
首页 > 其他好文 > 详细

8.11.3 统计大小写字符个数

时间:2019-05-20 21:12:44      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:void   getchar   技术   大写   getch   http   .com   return   ret   

技术图片

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

技术图片

8.11.3 统计大小写字符个数

标签:void   getchar   技术   大写   getch   http   .com   return   ret   

原文地址:https://www.cnblogs.com/EisNULL/p/10896304.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!