题目:读入一段文本到vector 对象,每个单词存储为vector 中的一个元素。把vector对象中每个单词转化为大写字母。输出vector 对象中转化后的元素,每8 个单词为一行输出。
源码:
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
using namespace std;
int main()
{
vector<string> svec;
string str;
cout << "Enter text(Ctrl+Z to end): "<<endl;
while (cin >> str)
svec.push_back(str);
if (!svec.size())
{
cout<<"No string?!"<<endl;
return -1;