合肥工业大学oj 1059 字符统计

#include<stdio.h>
#include<cctype>
using namespace std;

int a, b, c;
char ch;

int main(){    
    while((ch = getchar()) != EOF){//需要使用c语言一个一个来读取字符
        if(isdigit(ch)) a++;//分别统计即可
        else if(isalpha(ch)) b++;
        else c++;
    }
    printf("%d %d %d\n", a, b, c); 
    return 0;
}

//presented by 大吉大利,今晚AC

猜你喜欢

转载自blog.csdn.net/lalala_HFUT/article/details/87901890