3.3.2 向vector对象中添加元素

3.3.2 向vector对象中添加元素_第1张图片
练习3.14

#include 
#include 
using namespace std;

int main() {
     

	vector<int> a;
	int b;
	while (cin >> b)
		a.push_back(b);
	
}

练习3.15

#include 
#include 
using namespace std;

int main() {
     

	vector<string> a;
	string b;
	while (cin >> b)
		a.push_back(b);
	
}

你可能感兴趣的:(Primer,C++,第五版习题)