forked from grayghostvisuals/practice-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlolol
46 lines (34 loc) · 1.19 KB
/
lolol
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
#include<iostream>
#include<vector>
using namespace std ;
template < typename T > void printVector ( const vector < T > &integers2) ;
int main()
{
int size = 6;
int array[6] = {1,2,3,4,5,6};
vector< int > integers ;
cout<<" size of vector is "<< integers.size()<<endl<<" initial capacity of vector is "<<integers.capacity()<<endl;
integers.push_back(2);
integers.push_back(3);
integers.push_back(4);
for(int i=0;i<4;i++)
cout<<integers[i];
cout<<endl;
cout<<" size of vector is "<< integers.size()<<endl<<" output capacity of vector is "<<integers.capacity()<<endl;
// print normal array
printVector( integers);
vector < int > ::const_reverse_iterator revIt ;
vector < int > :: const_reverse_iterator tempIt = integers.rend();
for(revIt = integers.rbegin();revIt != tempIt ; ++revIt)
cout<<*revIt<<"\t";
cout<<endl;
return 0;
}
template < typename T > void printVector ( const vector < T > &integers2)
{
typename vector < T > ::const_iterator constint,infi;
infi = integers2.end();
for(constint= integers2.begin() ; constint != infi;++constint)
cout<<*constint<<"\t";
cout<<endl;
}