#include<stdio.h>
int main(
void)
{
int blank,digit,other;
char ch;
int i;
blank=digit=other=
0;
printf("Enter 10 characters:");
for(i=
1;i<=
10;i++
){
ch=
getchar();
switch(ch){
case' ':
case'\n':
blank++
;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
digit++
;
break;
default:
other++
;
break;
}
}
printf("blank=%d,digit=%d,other=%d\n",blank,digit,other);
return 0;
}
转载于:https://www.cnblogs.com/liruijia199531/p/3357273.html
转载请注明原文地址: https://win8.8miu.com/read-1558898.html