修改之前那个输出text第一段程序,首先把text的第一段全部改成大写形式,然后再输出它。
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
using namespace std;
int main(){
vector<string> text;
string s;
while (getline(cin, s))
text.push_back(s);
cout << "text.size: " << text.size() << endl;
for (auto it = text.begin();
it != text.end() && !it->empty(); ++it) {
for (auto c = (*it).begin(); c != (*it).end(); ++c)
{
*c = toupper(*c);
}
cout << *it << endl;
}
return 0;
}