-
Notifications
You must be signed in to change notification settings - Fork 1
/
Lab_06.cpp
47 lines (31 loc) · 1018 Bytes
/
Lab_06.cpp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <vector>
#include <deque>
using namespace std;
template<typename C>
void printContainer(const string comment, C const& container)
{
cout << comment << " = { ";
for(auto n: container)
{
cout << n << ",";
}
cout << "}; \n";
}
int main()
{
cout << "Create vector vector1" << endl;
vector<int> vector1 {101,92,63,54,22,34};
printContainer("vector1",vector1);
cout << "1- Use assign() to create a vector vector2 initialized with 5 'z' characters " << endl;
printContainer("vector2",vector2);
cout << "2- Create a new vector based on vector1 using assign()" << endl;
printContainer("vector3",vector3);
cout << "3- Compare vector1 and vector3" << endl;
cout << "4- Using assign() replace all elements of vector vector3" << endl;
printContainer("vector3",vector3);
cout << "5- Swap vector3 and vector1" << endl;
printContainer("vector1",vector1);
printContainer("vector3",vector3);
return 0;
}