#include using namespace std; class Intset { private: unsigned int * sp; // set pointer unsigned int set_size; public: static unsigned int SetLim; Intset() { sp=new unsigned int [SetLim]; set_size=0;} Intset(Intset& a); Intset(unsigned int* a); ~Intset() {delete [] sp;} int size() { return set_size; } bool member(unsigned int a); int insert(int a); int item(int ind); friend ostream& operator <<(ostream& f, Intset& set); friend istream& operator >>(istream& f, Intset& set); friend Intset& operator +(Intset &a,Intset &b); friend Intset& operator *(Intset &a,Intset &b); }; unsigned int Intset::SetLim; Intset::Intset(Intset &a) { for(int i=0;i>(istream &f, Intset& set) { int a,b,ec(1); cout << "How many elements should be added? "; f >> b; if(b==0) return f; else if(b<0) b=Intset::SetLim; cout << "Populating set:\n"; do { switch(ec) { case 1: b--; break; case 0: cout << "\tThe set's full! The last number(" << a << ") is not added.\n"; return f; case -1: cout << "\tThe number you entered is negative!\n"; break; case -2: cout << "\tThe set already contains this number.\n"; break; } cout << "\t>>> "; f >> a; }while((ec=set.insert(a)) && b); return f; } bool Intset::member(unsigned int a) { for(int i=0;i= SetLim) return 0; for(int i=0;i=0) return sp[ind]; return -1; } Intset& operator +(Intset &a,Intset &b) { Intset* asd=new Intset(); for(int i=0;iinsert(a.sp[i]); for(int i=0;iinsert(b.sp[i]); return *asd; } Intset& operator *(Intset &a,Intset &b) { Intset* asd=new Intset(); for(int i=0;iinsert(a.sp[i]); return *asd; } main() { int a; do { cout << "Set set size: "; cin >> a; }while(a<1); Intset::SetLim=a; Intset b,c; cin >> b; cout << b; cin >> c; cout << c; cout << (b+c) << "\t" << (b*c); return 0; }