#include <
stdio.h>
int main()
{
int alpha,digit,others;
char c;
for(alpha=digit=others=0;(c=getchar())!='\n';)
{
if(c>='a'&&c<='z'||c>='A'&&c<='Z')
alpha++;
else if(c>='0'&&c<='9')
digit++;
else
others++;
}
printf("%d %d %d\n",alpha,digit,others);
return 0;
}
追问大小写字母怎么统计
追答#include <stdio.h>
int main()
{
int alpha,ALPHA,digit,others;
char c;
for(alpha=ALPHA=digit=others=0;(c=getchar())!='\n';)
{
if(c>='a'&&c<='z')
alpha++;
else if(c>='A'&&c<='Z')
ALPHA++;
else if(c>='0'&&c<='9')
digit++;
else
others++;
}
printf("%d %d %d %d\n",alpha,ALPHA,digit,others);
return 0;
}
追问谢了
本回答被提问者采纳