NJC0806


私信TA

用户名:18827759342

访问量:6667

签 名:

简单的事情重复做,重复做的事情坚持做,坚持做的事情开心做。

等  级
排  名 1210
经  验 2988
参赛次数 2
文章发表 12
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

#include<iostream>
using namespace std;
int main()
{
     char str[100];
     int i=0,word=0,number=0,black=0,other=0;
     cin.getline(str,100);
     while(str[i]!='\0')
     {
          if(str[i]>='A'&&str[i]<='Z'||str[i]>='a'&&str[i]<='z')
               word++;
          else if(str[i]>='0'&&str[i]<='9')
               number++;
          else if(str[i]==' ')
               black++;
          else
               other++;
          i++;   
     }
     cout<<word<<' '<<number<<' '<<black<<' '<<other;
 return 0;
}
 

0.0分

0 人评分

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

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区