#include<vector>
#include<altorithm>
#include<iostream>
using namespace std;
int main()
{
vector<int> v;
ostream_iterator<int>out(cout, " ");
// vector<int>::iterator i = v.begin();
int h; // Illustrte push_back() function
for(int i=0; i<10; i++)
{
cin>>h;
v.push_back(h);
}
cout<<"Display the Elements of the vector v\n";
copy(v.begin(), v.end(), out);
cout<<endl<<endl;
sort(v.begin(), v.end());
//sort the vector from positon begin till position end
cout<<"Display Elements after Sorting\n";
copy(v.begin(), v.end(), out);
cout<<endl<<endl;
if(binary_sear(v.begin(), v.end(), 3))
cout<,"Yes, 3 occurs in vector v."<<endl;
// perform binary search for element 3 in the vector v else
cout<<"No, didn't find 3 in vector v."<<endl;
vector<int>::iterator p;
p = lower_bound(v.begin(), v.end(), 4);
/* lower_bound gives the first position where the element 4 occurs */
cout<<"position of first occurrence of 4 is : "<<*p<<"\n;
//copy(p,v.end(),out);
cout<<endl;
p = upper_bound(v.begin(), v.end(), 7);
// upper_bound : It gives the last position where the element 7
// in the vector between the two bounds, v.begin() and v.end()
cout<<"position of last occurrence of 7 is : "<<*p<<"\n;
cout<<endl;
// Declare w as an object of type vector
// and initialize it to vector object v.
vecor<int>w(v);
cout<<"Display the elements of vector w\n";
if(v = = w)
copy(w.begin(), w.end(), out);
return 0;
}