#include <stdio.h>
int count(char *s,int *t)
{
char *p=s;
while(*p!='\0')
{
if(*p>='a' && *p<='z' || *p>='A' && *p<='Z')
t[0]++;
else if(*p>='0' && *p<='9')
t[1]++;
else if(*p==' ')
t[2]++;
else
t[3]++;
p++;
}
}
int main()
{
int i,t[4];
char s[100];
while(gets(s))
{
for(i=0;i<4;i++)
t[i]=0;
count(s,t);
for(i=0;i<4;i++)
printf("%d ",t[i]);
printf("\n");
}
}
正文
字符统计2005-09-10 10:43:00
【评论】 【打印】 【字体:大 中 小】 本文链接:http://blog.pfan.cn/elva6401/4586.html
阅读(2875) | 评论(0)
版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!
评论