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

汉字进行统计------(汉字的二进制的最高位为1,十进制为负数)

时间:2019-10-13 12:47:29      阅读:82      评论:0      收藏:0      [点我收藏+]

标签:out   get   pre   using   int   nbsp   ring   isa   disable   

#include <iostream>
#include <string>
#pragma warning(disable:4996)
using namespace std;

int main(){
    string str;
    int T = 0;
    scanf("%d ", &T);-----新的知识scanf("%d ",&T)加空格可以带走换行符
    while (T)
    {
        int res = 0;
        T--;
        getline(cin, str);
        for (int i = 0; i < str.length(); ++i){
            if (str[i] < 0)
            {
                res++;
            }
        }
            
        cout << res/2 << endl;
        str.clear();
    }
}

 

汉字进行统计------(汉字的二进制的最高位为1,十进制为负数)

标签:out   get   pre   using   int   nbsp   ring   isa   disable   

原文地址:https://www.cnblogs.com/z2529827226/p/11665528.html

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