zoukankan      html  css  js  c++  java
  • 从cin读入一组词并把它们存入一个vector对象,然后设法把所有词都改写为大写字母。

    #include<iostream>
    #include<vector>
    #include<string>
    using  namespace std;
    
    int main()
    {
        string word;
        vector<string> Str;
        while(cin>>word)
            Str.push_back(word);
        for(auto c:Str)
        {
             cout<<c<<" ";
             for(auto &ch:c)
                ch=toupper(ch);
             cout<<c<<endl;
        }
        cout<<endl;
        return 0;
    }

    运行结果:

  • 相关阅读:
    PHP
    PHP
    PHP
    PHP
    PHP
    MySQL
    PHP
    PHP
    PHP
    linux 用户及用户组管理
  • 原文地址:https://www.cnblogs.com/wuchanming/p/3888229.html
Copyright © 2011-2022 走看看