#include<iostream>
#include<algorithm>
#include<iterator>
using std::cout;
using std::endl;
int main()
{
const int SIZE1 = 10, SIZE2 = 5, SIZE3 = 20;
int a1[SIZE1] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int a2[SIZE2] = { 4, 5, 6, 7, 8 };
int a3[SIZE2] = { 4, 5, 6, 11, 15 };
std::ostream_iterator<int> outputIt( cout, " " );
cout<<"a1 contains: ";
std::copy( a1, a1 + SIZE1, outputIt );
cout<<"/na2 contains: ";
std::copy( a2, a2 + SIZE2, outputIt );
cout<<"/na3 contains: ";
std::copy( a3, a3 + SIZE2, outputIt );
if( std::includes( a1, a1 + SIZE1, a2, a2 + SIZE2 ) )
cout<<"/n/na1 includes a2";
else
cout<<"/n/na2 does not includes a2";
if( std::includes( a1, a1 + SIZE1, a3, a3 + SIZE2 ) )
cout<<"/n/na1 includes a3";
else
cout<<"/n/na1 does not includes a3";
int difference[SIZE1];
int* ptr = std::set_difference( a1, a1 + SIZE1, a2, a2 + SIZE2, difference );
cout<<"/n/nset_difference of a1 and a2 is: ";
std::copy( difference, ptr, outputIt );
int intersection[SIZE1];
ptr = std::set_intersection( a1, a1 + SIZE1, a2, a2 + SIZE2, intersection );
cout<<"/n/nset_intersection of a1 and a2 is: ";
std::copy( intersection, ptr, outputIt );
int symmetric_difference[ SIZE1 ];
ptr = std::set_symmetric_difference( a1, a1 + SIZE1, a3, a3 + SIZE2, symmetric_difference );
cout<<"/n/nset_symmetric_difference of a1 and a3 is: ";
std::copy( symmetric_difference, ptr, outputIt );
int unionSet[ SIZE3 ];
ptr = std::set_union( a1, a1 + SIZE1, a3, a3 + SIZE2, unionSet );
cout<<"/n/nset_union of a1 and a3 is: ";
std::copy( unionSet, ptr, outputIt );
cout<<endl;
return 0;
}