头像
王澜
发布于 2020-02-14 11:30
+ 关注

C

#include<stdio.h>
int main()
{
    char ch;
    int Letters=0,Digits=0,Others=0;
    while((ch=getchar())!='?')    {
        if((ch>='a'&&ch<='z')||(ch<='Z'&&ch>='A'))
        {
            Letters++;
        }
        else if(ch==' ')
        {
            Others++;
        }
        else if(ch>='0'&&ch<='9')
        {
            Digits++;
        }
        else
        {
            Others++;
        }
    }
    printf("Letters=%d\nDigits=%d\nOthers=%d\n",Letters,Digits,Others);
    return 0;
}

全部评论

(0) 回帖
加载中...
话题 回帖

本文相关内容

等你来战

查看全部

热门推荐