编程题: 输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数。(分别使用wh
编程题: 输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数。(分别使用wh
日期:2018-04-17 01:41:20 人气:1
代码:#include
void main()
{
int letter=0,space=0,digit=0,other=0;
char c;
while((c=getchar())!='\n')
{
if('a'<=c && c<='z' || 'A'<=c && c<='Z')
letter++;
else if(c==' ')
space++;
else if('