#include "set.h" //********prototype long * expand(long * ar, int oldSize, int newSize); //expand set //constructors Set::Set(){ // the default constructor nelements=0; size=100; data=new long[size]; } Set::Set(long a, long b, long c){ nelements=0; size=100; data=new long[size]; int result=a; for(int i=1; result <=b; i++){ operator<<(result); result=a+i*c; } } // initializes the set to elements // contained in the array list; the size should be size of the array // (note: you cannot assume that elements in list are all distinct) Set::Set(long list[],long size2) { nelements=0; size=100; data= new long[size]; for (int i=0; is.nelements) return false; for (int i=0; i=(const Set &s) const{ // return true if s is subset of this object if(s.nelements>nelements) return false; for (int i=0; ix) break; } int j; for (j=nelements-1; j>=index; j--)//shift elements to make room for the new x data[j+1]=data[j]; data[index]=x; nelements++; return *this; } Set & Set::operator>>(long x) // remove x from the set { if (operator()(x)==false) //x does not exist return *this; //do nth int index; for (index=0;index> (data[i]); i--; } } return *this; } Set Set::operator-(const Set &s) const{ // return the set difference with the set s Set temp; for (int i=0; i> (data[i]); i--; } } return *this; } ostream & operator<<(ostream &os, const Set &s)// print the content of the set s { os << "{"; for (int i=0; i0) os << ","; os<< s.data[i]; } os << "}"; return os; }