File tree 3 files changed +45
-2
lines changed
3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1
- 2 10 3
2
- 3
1
+ 7
2
+ 10 20 50 50 50 50 50
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+ using namespace std ;
3
+
4
+ int main ()
5
+ {
6
+ vector<int > v;
7
+ v.push_back (10 );
8
+ v.push_back (20 );
9
+ v.push_back (30 );
10
+ v.push_back (40 );
11
+ v.push_back (50 );
12
+
13
+ v.resize (2 );
14
+ v.resize (7 , 50 );
15
+ cout << v.size () << endl;
16
+ for (int i : v)
17
+ {
18
+ cout << i << " " ;
19
+ }
20
+
21
+ /* v.clear();
22
+ cout << v.size() << endl;
23
+ for (int i : v)
24
+ {
25
+ cout << i << " ";
26
+ }
27
+
28
+ cout << v[4] << endl; */
29
+ // cout << v.max_size() << endl;
30
+ /* cout << v.capacity() << endl;
31
+ v.push_back(10);
32
+ cout << v.capacity() << endl;
33
+ v.push_back(20);
34
+ cout << v.capacity() << endl;
35
+ v.push_back(30);
36
+ cout << v.capacity() << endl;
37
+ v.push_back(40);
38
+ cout << v.capacity() << endl;
39
+ v.push_back(50);
40
+ cout << v.capacity() << endl; */
41
+
42
+ return 0 ;
43
+ }
You can’t perform that action at this time.
0 commit comments