#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() {delete [] sp;} //Intset() {} //Intset() {} friend ostream& operator <<(ostream& f, Intset& set); friend istream& operator >>(istream& f, Intset& set); int size() { return set_size; } bool member(unsigned int a); int insert(int a); int item(int ind); }; unsigned int Intset::SetLim; ostream& operator <<(ostream& f,Intset& set) { f << "["; for(int i=0;i>(istream &f, Intset& set) { int a,b; 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 { cout << "\t>>> "; f >> a; }while(set.insert(a)!=-1 && --b); return f; } bool Intset::member(unsigned int a) { for(int i=0;i= SetLim) { cout << "The set's full! The last number(" << a << ") is not added.\n"; return -1; } for(int i=0;i=0) return sp[ind]; return -1; } main() { int a; do { cout << "Set set size: "; cin >> a; }while(a<1); Intset::SetLim=a; Intset b,c; cin >> b; cout << b; cout << b.member(6) << "\t" << b.member(100) << "\t" << b.item(1) << "\t" << b.item(7) << "\t" << b.item(20); return 0; }