#include <ctype.h>
int main(void) {
size_t num = {0};
size_t blank = 0;
size_t others = 0;
int ch;
while((ch = getchar()) != EOF) {
if(isdigit(ch)) ++num;
else if(isblank(ch)) ++blank;
else ++others;
}
for(size_t i = 0; i < 10; ++i)
printf("num[%lu]: %lu\n", i, num);
printf("blank: %lu\n", blank);
printf("others: %lu\n", others);
return 0;
}
ctype.h
页:
[1]