C++Primer 3.3.3 练习3.17 关于while的换行结束

#include <iostream>
#include <string>
#include <vector>


using namespace std;


int main()
{
	vector<string> strVec;
	string str;

	while (cin >> str) {
		
		strVec.push_back(str);
		for (auto &a : strVec) {
			for (auto &b : a)
				b = toupper(b);
		}
		if (getchar() == '\n' && !str.empty())
			break;
	}

		
	for (auto a : strVec)
		cout << a << ' ';


	
    return 0;
}


版权声明:本文为senbascira原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。