.统计一段英文中英文字母、空格、数字和其它字符的个数。

要求统计的英文句子如下:
char c[200]="Andy: These walls are kind of funny like that. First you hate them, and then you get used to them. Enough time passed, get so you depend on them. That's institutionalized."

统计 字符 是吧
,用 C语言
编程 即可实现
程序 如下

#include <stdio.h>
int main()
{
int da=0,xiao=0,kon=0,num=0,other=0;
int i,j;
char zifu[3][80];
printf ("输入字符:\n");
for (i=0;i<3;i++)//输入三行字符
gets(zifu[i]);
for (i=0;i<3;i++)
for (j=0;j<80;j++)
{if (zifu[i][j]>='A'&&zifu[i][j]<='Z')
da++;
else if (zifu[i][j]>='a'&&zifu[i][j]<='z')
xiao++;
else if (zifu[i][j]<='9'&&zifu[i][j]>='0')
num++;
else if (zifu[i][j]==32)
kon++;
else other++;}
printf ("大写字母有%d\n小写字母%d\n数字有%d\n空格%d\n其他有%d\n",da,xiao,num,kon,other);
return 0;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-12-25
。。。。。。。。。。你自己把东西复制到word里,然后选中你要查找的空格什么的,

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网