#include #include #include #include #include #include using namespace std; //myAlgo_unique_copy1.cpp bool Compare( int ,int ); int main() { int n1[10] = { 69 ,75,63,61,65,64,64,64,71,70 }; vectorv1( n1, n1+10), v2; vector::iterator it; ostream_iterator< int > output( cout, " " ); cout<<"\n orignal array \n "; copy(v1.begin(), v1.end(), output); cout<<"\n uisng unique \n "; it = unique(v1.begin(), v1.end(), Compare); v1.resize(it- v1.begin()); copy(v1.begin(), v1.end(), output); // cout<<"\n unique copy \n "; v2.resize(10); it = unique_copy(v1.begin(),v1.end(),v2.begin()); v2.resize(it- v2.begin()); copy(v2.begin(), v2.end(), output); return 0; } bool Compare( int value1,int value2 ) { return value1==value2 ; }