CE贝多芬


私信TA

用户名:hjl88

访问量:7264

签 名:

等  级
排  名 72
经  验 9931
参赛次数 20
文章发表 293
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

#include<iostream>

#include<ctype.h>

#include<string.h>

using namespace std;

int main()

{

    int a=0,b=0,c=0,d=0;

    char str[1000];

    gets(str);

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

        if(toupper(str[i])>='A'&& toupper(str[i])<='Z')

        a++;

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

        b++;

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

        c++;

        else d++;

    }

    cout<<a<<endl<<b<<endl<<c<<endl<<d;

    return 0;

}


 

0.0分

0 人评分

  评论区