File tree Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Expand file tree Collapse file tree 1 file changed +67
-0
lines changed 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+ for (int i = 1 ; i<10 ; i++) {
8+ v.push_back (i);
9+ }
10+ for (auto i = v.begin (); i!=v.end (); ++i) {
11+ cout << *i << " " ;
12+ }
13+ cout << endl;
14+ for (auto i = v.cbegin (); i!=v.cend (); ++i) {
15+ cout << *i << " " ;
16+ }
17+ cout << endl;
18+
19+ for (auto i = v.rbegin (); i!=v.rend (); ++i) {
20+ cout << *i << " " ;
21+ }
22+ cout << endl;
23+
24+ for (auto i = v.crbegin ();i!=v.crend (); ++i) {
25+ cout << *i << " " ;
26+ }
27+ cout << endl;
28+
29+ cout << " Size: " << v.size ();
30+ cout << " \n Capacity: " << v.capacity ();
31+ cout << " \n Max_Size: " << v.max_size ();
32+
33+
34+ v.assign (5 , 10 );
35+ cout << " The vector elements is : " ;
36+ for (int i =0 ; i<v.size (); i++) {
37+ cout << v[i] <<" " ;
38+ }
39+ cout << endl;
40+
41+ v.push_back (15 );
42+ int n = v.size ();
43+ cout << " The last element is: " << v[n-1 ];
44+
45+
46+ v.pop_back ();
47+ cout << " \n Current elements; " ;
48+
49+ for (int i =0 ; i<v.size (); i++) {
50+ cout << v[i] << " " ;
51+ }
52+
53+ v.insert (v.begin (), 5 );
54+ cout <<" \n The first element is : " << v[0 ];
55+
56+ v.emplace (v.begin (), 6 );
57+ cout << " \n The first element is : " << v[0 ];
58+
59+
60+
61+
62+
63+
64+
65+
66+ return 0 ;
67+ }
You can’t perform that action at this time.
0 commit comments