#include “stdio.h”
#include “stdlib.h”
#include “conio.h"int main()
{ intcounter_num=0,counter_space=0,counter_other=-1;
char c;
while(1)
{ c=getche();
if (c>=‘0’&&c<=‘9’) counter_num++;
else if (c==’ ') counter_space++;
else
counter_other++;
if(c==26)
{ printf(”\n\ncounter_num=%d\tcounter_space=%d\t,counter_other=%d\n",counter_num,counter_space,counter_other); exit(1);
}
}
}
从键盘输入字符,以 ctrl+z 结束,统计输入的数字 0~9、空白符和其它字符的个数。
最新推荐文章于 2022-11-05 20:47:48 发布