-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp3.cpp
65 lines (39 loc) · 1.02 KB
/
p3.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <array>
#include <vector>
#include <deque>
using namespace std;
int main()
{
//array
array <int,5> a = {2,4,5,8,9};
cout << a.size() << endl;
cout << a.front() << a[2] << endl;
std :: cout << a.back() << a.empty() << endl;
//vector
vector<int> v;
v.push_back(2);
v.push_back(6);
cout << v.at(1) << v[2] << endl;
v.push_back(5);
v.pop_back();
cout << v.size() << v.capacity() << endl;
cout << v.front() << v.back() << endl;
v.clear();
cout << v.size() << v.capacity() << endl;
vector<int> b(5,2);
vector<int> c(b);
//deque
deque<int> d;
d.push_back(8);
d.push_back(7);
d.push_front(3);
d.push_front(9);
cout << d.at(0) << d[1] << endl;
cout << d.front() << d.back() << endl;
d.pop_back();
d.pop_front();
cout << d.front() << d.back() << endl;
cout << d.size() << d.empty() << endl;
return 0;
}