码迷,mamicode.com
首页 > 其他好文 > 详细

2017.字符串统计

时间:2018-10-02 17:28:01      阅读:99      评论:0      收藏:0      [点我收藏+]

标签:字符串统计   sof   nbsp   int   \n   stream   ace   return   space   

#include<iostream>

using namespace std;

int main(){

         int n,i,s;

         char x;

         cin>>n;

         getchar();

         for(i=0;i<n;i++){

                   s=0;

                   while((x=getchar())!=‘\n‘)

                   if(x>=‘0‘&&x<=‘9‘)

                   s++;

                   cout<<s<<endl;

         }

         return 0;

}

 

2017.字符串统计

标签:字符串统计   sof   nbsp   int   \n   stream   ace   return   space   

原文地址:https://www.cnblogs.com/huoyuying/p/9736634.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!