输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数

void main()
{
   int s=0,num=0,q=0,other=0,n=0;
   
   char c[100]={0};
   printf("请输入一行字符:\n");


while(c[n])

{
if (sialpha(s[n])) 
{
s++;//英文字母
}
else if (s[n]==32)
{
num++;//数字
}
else if(sidigit(s[n])
q++;//空格
else
other++//其他
n++;


}
printf("%d %d %d\n",s,num,q);
}

猜你喜欢

转载自blog.csdn.net/qq_40246956/article/details/80373838