20. 编程实现从键盘输入一句话保存在数组中,统计其包含的英文字母个数并输出统计结果。
程序代码:
程序代码:#include<stdio.h>
int main()
{
char s[80];
char *p=s;
int count=0;
gets(s);//其实这里并不太推荐用gets,可以用scanf("%[^\n]s%*c",s);代替输入,不过新手先用gets也未尝不可~
for (;*p;++p)
{
if (*p>='a'&&*p<='z')
count++;
else if (*p>='A'||*p<='Z')
count++;
}
printf("%d\n",count);
return 0;
}[此贴子已经被作者于2016-12-14 02:24编辑过]

[code]/*~个性签名:bug是什么意思?bug是看上去没有可能的东西实际上是有可能做到的 就是这样~2018-08-08更~*/[/code]








