#ifndef SET_H #define SET_H #include class Set { // Returns a set which is the union of s1 and s2 friend Set Union (const Set& s1, const Set& s2); // Returns a set which is the intersection of s1 and s2 friend Set Intersection (const Set& s1, const Set& s2); // Returns a set which is the difference s1 - s2 friend Set Difference (const Set& s1, const Set& s2); private: // The design of the private section is left to you. // Declare private data and function members here. // Do NOT change any of the declarations in the public // section or the friend functions above. public: // Constructs an empty set Set (); // Construct a set with a single element which is // the value n Set (int n); // Construct a set whose elements are the integers // between begin and end, inclusive // // Pre-condition: begin <= end Set (int begin, int end); // Construct a set whose elements are specified in // an integer array pointed to by the first argument. // The second argument specifies the size of the array. // If the array has any duplicate elements, they are ignored. // // Pre-condition: numElems >= 1 Set (int* iarray, int numElems); // Copy constructor Set (const Set& s); // Destructor ~Set (); // Displays the elements of the set in ascending order. // The elements are displayed as a comma-separated list // enclosed in curly braces. For example: // // { 1, 4, 5, 11, 13, 19 } // // If the set is empty, this function simply prints the // word "Empty". void Display () const; // Tests for membership in the set. // Returns true if and only if n is a member of the set. bool IsMember (int n) const; // Returns the cardinality of the set int Cardinality () const; // Overloaded assignment operator Set& operator = (const Set& s); // Overloaded equality operator bool operator == (const Set& s) const; // Returns true if and only if the set is a subset of s bool IsSubsetOf (const Set& s) const; // Returns true if and only if the set is a proper subset of s bool IsProperSubsetOf (const Set& s) const; }; #endif