summaryrefslogtreecommitdiff
path: root/3p18.cpp
blob: 02c1f25eaa2a73cec462380369befbb025bf85d6 (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
27
#include <iostream>
#include <vector>

/*
 *
 * 3.18
 *
 *
 */

using std::string;
using std::cout;
using std::cin;
using std::cerr;
using std::clog;
using std::endl;
using std::vector;
int main () {

    vector<int> ivec1;
	vector<int> ivec2(10); // We could initialize it with some elements
	vector<int> ivec3{42}; // We could initialize it with the first element being 42	
	ivec1.push_back(42); // One way we might fix it
	ivec2[0] = 42;
	cout << ivec1[0] << " " << ivec2[0] << " " << ivec3[0] << endl;
	return 0;
}