作者在 2017-03-27 19:47:53 发布以下内容
#include <stdio.h>
int main ()
{char ch;
int a,b,c,d;
a=0;
b=0;
c=0;
d=0;
while((ch=getchar())!='\n');
{if(ch>='a'&&ch<='z'||ch<='z'&&ch>='a')
{a=a+1;}
else if(ch==' ')
{b=b+1;}
else if(ch>='0'&&ch<='9')
{c=c+1;}
else
{d=d+1;}
}
printf("字母%d,空格%d,数字%d,其他%d",a,b,c,d);
return 0;
}
int main ()
{char ch;
int a,b,c,d;
a=0;
b=0;
c=0;
d=0;
while((ch=getchar())!='\n');
{if(ch>='a'&&ch<='z'||ch<='z'&&ch>='a')
{a=a+1;}
else if(ch==' ')
{b=b+1;}
else if(ch>='0'&&ch<='9')
{c=c+1;}
else
{d=d+1;}
}
printf("字母%d,空格%d,数字%d,其他%d",a,b,c,d);
return 0;
}