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

从cin读入一组词并把它们存入一个vector对象,然后设法把所有词都改写为大写字母。

时间:2014-08-03 12:38:05      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   for   2014   

#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;
}

运行结果:

bubuko.com,布布扣

从cin读入一组词并把它们存入一个vector对象,然后设法把所有词都改写为大写字母。,布布扣,bubuko.com

从cin读入一组词并把它们存入一个vector对象,然后设法把所有词都改写为大写字母。

标签:style   blog   http   color   os   io   for   2014   

原文地址:http://www.cnblogs.com/wuchanming/p/3888229.html

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