雾山五行


私信TA

用户名:uq_26515002996

访问量:611

签 名:

等  级
排  名 10316
经  验 1041
参赛次数 0
文章发表 14
年  龄 0
在职情况 在职
学  校
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

    #include <stdio.h>

    #include <string.h>

    /*

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

    */

    int main(){

             char s[200];

             int c=0,n=0,o=0,sp=0;;

             gets(s);

            

             for(int i=0;i<(int)strlen(s);i++){

                     if((s[i]>='A' && s[i]<='Z') || (s[i]>='a' && s[i]<='z') )

                     {

                             c++;

                     }

                     else if(s[i]>='0' && s[i]<='9')

                     {

                             n++;

                     }

                     else if(s[i]==' ')

                     {

                              sp++;

                     }

                     else

                     {

                            o++;

                     }

             }

             printf("%d %d %d %d",c,n,sp,o);

             return 0;

    }


 

0.0分

0 人评分

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

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区