#include<iostream>
#include<string>
#include <vector>
#include <cctype>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
int main()
{
string word;
vector<string> str;
while(cin >> word){
str.push_back(word);
}
for(auto &i : str){
for(auto &p : i) //这里最外层是从vector里取出一个string。
p=toupper(p); //里面那层再从string中取出一个字母
cout << i << endl; //注意:这是层层范围递减传递进去的!
}
return 0;
}
读入一个句子,把所有词都变成大写,输出,每个词占一行
最新推荐文章于 2019-09-26 17:17:25 发布