//*********************************** //习题 3.14 //*********************************** #include <iostream> #include <vector> #include <string> using namespace std; int main() { vector<string> svec; string str; //read txt into sevc cout<<"Enter text(Ctrl+z to end):"<<endl; while (cin>>str) { svec.push_back(str); } if (svec.size()==0) { cout<<"No string!"<<endl; return -1; } cout<<"Transformed elements from the vector:"<<endl; for (vector<string>::size_type ix=0;ix!=svec.size();++ix) { for (string::size_type index=0;index!=svec[ix].size();++index) { if (islower(svec[ix][index]))//字符为小写字母 { svec[ix][index]=toupper(svec[ix][index]); } } cout<<svec[ix]<<" "; } return 0; }