You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//program to demonstrate the generate(), generate_n(), includes() function
std::vector<int> v(10);
//assigning 0-9 to the vectors element
std::generate(v.begin(),v.end(),gen);
//printing the vectors
std::vector<int>::iterator p ;
std::cout<<"Vector v : ";
for(p = v.begin();p!=v.end();p++)
{
std::cout<<*p<<" ";
}
std::cout<<std::endl;
//using the generate_n function
std::cout<<"Updated Vector v : ";
std::generate_n(v.begin()+1,4,gen);
for(p = v.begin();p!=v.end();p++)
{
std::cout<<*p<<" ";
}
std::cout<<std::endl;
//includes() determines if the sequence defined by the start1 and end1 includes all of the elements in the sequence defined by the start2 and end2. it returns true if the elements all of the elements are all found and false otherwise.