zoukankan      html  css  js  c++  java
  • Exercice_3.14

    //读取一段文本 并将他们转化为大写字母
    #include <iostream>
    #include <vector>
    #include <string>
    #include <cctype>
    using namespace std;
    
    int main()
    {
        vector<string> svec;
        string sval;
    
        //读取一段文本
        cout << "Enter words." << endl;
        while (cin >> sval)
            svec.push_back(sval);
    
    
        //将他们转化为大写
        if (svec.size() == 0)
        {
            cout << "No elements?!" << endl;
            return -1;
        }
    
        for (vector<string>::size_type ix = 0; ix != svec.size(); ++ix)
        {
            sval = svec[ix];
            for (string::size_type index = 0; index != sval.size(); ++index)
                sval[index] = toupper(sval[index]);
            cout << sval << "	";
    
            if ((ix + 1) % 8 == 0)
                cout << endl;
    
        }
        return 0;
    }
    

  • 相关阅读:
    BZOJ
    BZOJ
    BZOJ
    BZOJ
    BZOJ
    BZOJ
    [知识点]平衡树之Splay
    [BZOJ1015/JSOI2008]星球大战
    [知识点]状态压缩DP
    [NOIP2011]聪明的质检员
  • 原文地址:https://www.cnblogs.com/mrbourne/p/9959471.html
Copyright © 2011-2022 走看看