/*
练习3.17:
从cin计入一组词并把它们存入一个vector对象,然后把所有词都改写为大写形式。输出改变后的结果,每个词占一行。
*/
#include "TouWenJian.h"
int main()
{
string word;
vector<string> v1;
while(cin>>word)
{
for(auto &YinYongBianLiang:word)
YinYongBianLiang=toupper(YinYongBianLiang);
v1.push_back(word);
}
for(auto TempVar:v1)
cout<<TempVar<<endl;
cout<<endl;
return 0;
}
C++Primer第五版第三章练习3.17
最新推荐文章于 2025-12-09 23:06:20 发布
本文介绍了如何使用C++编程,通过cin从用户输入中读取单词,将每个单词转换为大写形式,并存储在vector中,最后逐行输出处理后的单词。
602

被折叠的 条评论
为什么被折叠?



