- #include <stdio.h>
- #include <string.h>
- int main(void)
- {
- int num_az=0;
- int num_AZ=0;
- char ch;
- int num_digital=0;
- int others=0;
- printf("输入字符,以*作为字符输入结束标志。\n");
- while((ch=getchar())!='*'){
- putchar(ch);
- if (ch>='0'&& ch<='9'){
- num_digital++;
- }else if(ch >='a' &&ch<='z'){
- num_az++;
- }else if(ch >='A' && ch <= 'Z'){
- num_AZ++;
- }else{
- others++;
- }
- }
- printf("数字个数:%d\n 大写字母个数:%d\n 小写字母个数:%d\n 其他:%d\n",num_digital ,num_AZ,num_az ,others);
-
- return 0;
- }
复制代码 |