Write a class that implements a 'Set' of integers. A set is a collection of items in which no item occurs more than once. Internally, you must represent the set using an array of size 100 and write...






Make a simple c++ code











Write a class that implements a 'Set' of integers.<br>A set is a collection of items in which no item occurs more than once. Internally,<br>you must represent the set using an array of size 100 and write any private<br>functions suitable. However, the class should have the given 'public' functions.<br>Signatures/Protocols of these functions are as follows: (you can use additional<br>functions and members variable if required)<br>class MySet {<br>private:<br>//array of size 100<br>public:<br>MySet (); //constructor<br>void add (int element); // add an element (no<br>repetition in sets)<br>void remove (int element); // remove an element<br>int count (); // returns present count of the elements<br>bool isMember (int element); //returns if an element is<br>present<br>void print (); //prints all elements in ascending order<br>bool check equal () // A check equal () method which<br>takes another set as argument and returns true if both<br>are equal. Remember two sets with same elements are<br>equal regardless of the order o£<br>elements<br>}<br>

Extracted text: Write a class that implements a 'Set' of integers. A set is a collection of items in which no item occurs more than once. Internally, you must represent the set using an array of size 100 and write any private functions suitable. However, the class should have the given 'public' functions. Signatures/Protocols of these functions are as follows: (you can use additional functions and members variable if required) class MySet { private: //array of size 100 public: MySet (); //constructor void add (int element); // add an element (no repetition in sets) void remove (int element); // remove an element int count (); // returns present count of the elements bool isMember (int element); //returns if an element is present void print (); //prints all elements in ascending order bool check equal () // A check equal () method which takes another set as argument and returns true if both are equal. Remember two sets with same elements are equal regardless of the order o£ elements }

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here