晨三娃


私信TA

用户名:13008142306

访问量:21013

签 名:

我的语言,没有对象

等  级
排  名 389
经  验 4961
参赛次数 6
文章发表 28
年  龄 20
在职情况 学生
学  校 西华大学
专  业 计算机科学与技术

  自我简介:

#include <iostream>

#include <string>

using namespace std;

int main ()

{

int yingwen=0,kongge=0,shuzi=0,qita=0;

string str;

getline(cin,str);

int len=str.size();

for(int i=0;i<len;i++)

if((str.at(i)>='a' && str.at(i)<='z') || (str.at(i)>='A' && str.at(i)<='Z'))

yingwen++;

else if(str.at(i)==' ')

kongge++;

else if(str.at(i)>='0' && str.at(i)<='9')

shuzi++;

else qita++;

cout<<yingwen<<endl;

cout<<kongge<<endl;

cout<<shuzi<<endl;

cout<<qita<<endl;

return 0;

}


 

0.0分

0 人评分

  评论区