diff --git a/字符分类统计 b/字符分类统计 new file mode 100644 index 0000000..0378f26 --- /dev/null +++ b/字符分类统计 @@ -0,0 +1,16 @@ +int main(int argc,char *argv[]) +{ +int digit=0,space=0,letter=0,other=0; +char c; +while((c=getchar())!=’\n’) +if( c<=’9’ && c>=’θ’) +digit++; +else if((c<=’z’ && c>=’a’) || (c<=’Z’ && c>=’A’) ) +letter++; +else if( c ==’ ‘) +space++; +else +other++; +} +printf(“%d %d %d %d\n”,letter,digit,space,other); +return 0; \ No newline at end of file