summaryrefslogtreecommitdiff
path: root/9p29.cpp
blob: 6a89b0688af04ecb08d00910267a615b534e9ae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <vector>

/*
 *
 * 9.29
 *
 *
 */

int main () {

	// vec.size() == 25
	// vec.resize(100); would add 75 elements (vec.size() == 100)
	// vec.resize(10); would remove 15 elements (vec.size() == 10)
	std::vector<int> vec1(25, 0);
	std::vector<int> vec2(25, 0);
	std::cout << "(vec1) Original size: " << vec1.size() << std::endl;
	vec1.resize(100);
	std::cout << "(vec1) After resize(100): " << vec1.size() << std::endl;
	std::cout << "------------------------------" << std::endl; 
	std::cout << "(vec2) Original size: " << vec2.size() << std::endl;
	vec2.resize(10);
	std::cout << "(vec2) After resize(10): " << vec2.size() << std::endl;
	return 0;
}