解题思路:





注意事项:空格要用2个==号  不然不会输出others的内容






参考代码:

#include<stdio.h>

int main()

{

int digit,others,alph,kong;

char ch;

digit=others=alph=kong=0;

ch=getchar();

while(ch!='\n')

{

if(ch>='0'&&ch<='9')

{

digit++;

}

else if(ch>='A'&&ch<='Z'||ch>='a'&&ch<='z')

{

alph++;

}

else if(ch==32)

{

kong++;

}

else 

{

others++;

}

ch=getchar();

}

printf("%d %d %d %d",alph,digit,kong,others);

return 0;

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区