#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
vector<string> a;
string b;
cout << "输入字符串:";
getline(cin, b); //这儿直接getline
////////////////////////////////////////////////////////////////////////
auto it = b.begin();
while (it != b.end()) {
if (*it <= 32) it = b.erase(it); //去掉所有不可打印字符和空格
else it++;
}
/////////////////////////////////////////////////////////////////
a.push_back(b);
for (auto it = a.begin(); it != a.end() && !it->empty(); it++) {
for (auto it2 = it->begin(); it2 != it->end(); it2++)
*it2 = toupper(*it2);
cout << *it << endl;
}
system("pause");
return 0;
}
|