您的位置:首页 > 其它

假设用一个名为text的字符串向量存放文本文件的数据,其中的元素或者是一句话或者是一个用于表示段分隔的空字符串。将text中第一段全改为大写形式

2014-08-03 15:37 387 查看
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
vector<string> str={"The is C++ program ","hfh ","","hfdshfisoid"};
for(auto it=str.begin();it!=str.end()&&!it->empty();++it)
{
cout<<*it<<endl;
for(auto st=(*it).begin();st!=(*it).end();++st)
{
*st=toupper(*st);
}
cout<<*it<<endl;
}

return 0;
}


运行结果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐