嗯。无聊、搞个字符计数的
程序代码:#include <stdio.h>
void main()
{
char c;
int letters=0,space=0,digits=0,others=0;
printf("请输入一些字符:\n");
while((c=getchar())!='\n')
{
if(c>='a'&&c<='z'||c>'A'&&c<='Z')
{
letters++;
}
else if(c==' ')
{
space++;
}
else if(c>='0'&&c<='9')
{
digits++;
}
else
{
others++;
}
}
printf("其中包含:\n");
printf("字符为:%d\n空格为:%d\n数字为:%d\n其他为:%d\n",letters,space,digits,others);
}



