The document describes a C++ program that defines an Intset class for modeling sets of integers from 0 to 99. The class uses a boolean array to represent set membership and implements operators like union, intersection, difference, subset checking. The program allows the user to perform set operations on up to 10 sets, including adding/removing elements and comparing sets. Sample output shows a user creating sets A and B, performing union and intersection on them, and checking for subset/equality.
C++ using namespace std Attach the code or leave jn h.pdf
1. C++
using namespace std;
Attach the code or leave jn here please
3. Write a class intset for modeling sets of integers in the range 0 through 99. A set should be
represented internally as an array of type bool: The i th array element will be true whenever
integer i is in the set and will be false whenever integer i is not in the set. Include a no-argument
constructor that initializes a set to the so-called "empty set," i.e., a set whose array representation
contains all false values. The class should include the following overloaded operators: + to
perform the union of two set (the union of sets A and B is the set that contains all elements of set
A or set B, or both). * to perform the intersection of two sets (the intersection of sets A and B is the
set that contains all elements in both set A and set B.) - to form the difference of two sets (the
difference of sets A and B is the set containing those elements that are in A but not in B ) += to
add an integer into a set. - to delete an integer from a set. = to determine if two sets are equal. 1 to
form the complement of a set (the complement of setA, denoted A, is the set containing all the
elements in the universal set that are not in A - the universal set for this problem is the set
containing all integers between 0 and 99 ) = to determine if one set is a subset of another set (set
A is a subset of set B means that for any element x in A,x is also an element of set B ). to display a
set in roster notation (for example, {2,3,5,9} ) Requirement: The overloaded += and = operators
should check for valid integer input (in the range 099 ), or if an add-item is already in the set, or if a
delete-item is not in the set. An error message for invalid input should be generated. Then, write a
C++ program that uses the new Intset class. The program should allow the user to repeatedly
select from these options: - add numbers to a set - renove numbers from a set - form the union of
two sets - form the intersection of two sets - form the difference of two sets - determine if two sets
are equal - form the complement of an set - determine if one set is a subset of another setThen,
write a C++ program that uses the new Intset class. The program should allow the user to
repeatedly select from these options: - add numbers to a set - remove numbers from a set - form
the union of two sets - form the intersection of two sets - form the difference of two sets -
determine if two sets are equal - form the complement of an set - determine if one set is a subset
of another set - display a set The program should allow for up to ten sets to be created during a
given program run. Use any standalone functions you feel necessary. Here is output from a
sample run of the program (user input in bold): Select an option: 1 - add numbers to a set -
remove numbers from a set - form the union of two sets - form the intersection of two sets - form
the difference of two sets - determine if two sets are equal 7. form the complement of an set 8 -
determine if one set is a subset of another set 9 - display a set 10 - Exit1 Add numbers to which
sets (A, B,C, D, E, F, G, H, I, J)? : A Enter number to add: 1 Add another ( y or n ): y Enter number
2. to add: 3 Add another ( y or n ): y Enter number to add: 8 Add another (y or n) : n Select an option:
1 - add numbers to a set - remove numbers from a set - form the union of two sets - form the
intersection of two sets - form the difference of two sets - determine if two sets are equal - form the
complement of an set - determine if one set is a subset of another set - display a set 10 - Exit 9
Display set (A, B, C, D, E, F, G, H, I, J)? :A {1,3,8} Select an option: 1 - add numbers to a set 2 -
remove numbers from a set - form the union of two sets - form the intersection of two sets - form
the difference of two sets - determine if two sets are equal - form the complement of an set -
determine if one set is a subset of another set 9 - display a set 10 - Exit1 Add numbers to which
sets (A,B,C,D,E,F,G,H,I,J) ? :B Enter number to add: 2 Add another (y or n) : y Enter number to
add: 3 Add another (y or n ): y Enter number to add: 7 Add another (y or n):n Select an option: 1 -
add numbers to a set 2 - remove numbers from a set 3 - form the union of two sets 4 - form the
intersection of two sets - form the difference of two sets - determine if two sets are equal - form the
complement of an set 8 - determine if one set is a subset of another set 9 - display a set 10 - Exit 2
Remove numbers from which set (A,B,C,D,E,F,G,H,I,J) ? :A Enter number to remove: 1 Remove
another (y or n):nSelect an option: - add numbers to a set - remove numbers from a set - form the
union of two sets - form the intersection of two sets - form the difference of two sets - determine if
two sets are equal - form the complement of an set - determine if one set is a subset of another
set 9 - display a set 10 - Exit 3 Sets union - specify sets to use: First set: (A, B, C, D, E, F, G, H, I,
J)? :A Second set: (A, B, C, D, E, F, G, H, I, J)? :B Result set: (A, B, C, D, E, F, G, H, I, J)? :C
Select an option: 1 - add numbers to a set 2 - remove numbers from a set 3 - form the union of two
sets 4 - form the intersection of two sets 5 - form the difference of two sets 6 - determine if two
sets are equal 7 - form the complement of an set 8 - determine if one set is a subset of another set
9 - display a set 10 - Exit 4 Set intersection - specify sets to use: First set: (A, B, C, D, E, F, G, H,
I, J)? :A Second set: (A, B, C, D, E, F, G, H, I, J)?:B Result set: (A, B, C, D, E, F, G, H, I, J)? :D9 -
display a set 10 - Exit 3 Sets union - specify sets to use: First set: (A, B, C, D, E, F, G, H, I, J)? :A
Second set: (A, B, C, D, E, F, G, H, I, J)? :B Result set: (A, B, C, D, E, F, G, H, I, J)? :C Select an
option: 1 - add numbers to a set 2 - remove numbers from a set 3 - form the union of two sets 4 -
form the intersection of two sets 5 - form the difference of two sets 6 - determine if two sets are
equal 7 - form the complement of an set 8 - determine if one set is a subset of another set 9 -
display a set 10 Exit 4 Set intersection - specify sets to use: First set: (A, B, C, D, E, F, G, H, I, J)?
:A Second set: (A, B, C, D, E, F, G, H, I, J)? :B Result set: (A,B, C, D, E, F, G, H, I, J)? :D Select
an option: 1 - add numbers to a set 2 - remove numbers from a set 3 - form the union of two
setsSelect an option: 1 - add numbers to a set 2 - remove numbers from a set 3 - form the union of
two sets 4 - form the intersection of two sets - form the difference of two sets - determine if two
sets are equal - form the complement of an set - determine if one set is a subset of another set -
display a set 10 - Exit 5 Set difference - specify sets to use: First set: (A, B, C, D, E, F, G, H, I, J)?
:A Second set: (A, B, C, D, E, F, G, H, I, J)? :B Result set: (A, B, C, D, E, F, G, H, I, J)? :E Select
an option: 1 - add numbers to a set 2 - remove numbers from a set 3 - form the union of two sets -
form the intersection of two sets - form the difference of two sets - determine if two sets are equal -
form the complement of an set - determine if one set is a subset of another set - display a setSet
equality - specify sets to compare: First set: (A, B, C, D, E, F, G, H, I, J)? :A Second set: (A, B, C,
D, E, F, G, H, I, J)? :B These sets are not equal Select an option: 1 - add numbers to a set 2 -
3. remove numbers from a set 3 - form the union of two sets 4 - form the intersection of two sets 5 -
form the difference of two sets 6 - determine if two sets are equal 7 - form the complement of an
set 8 - determine if one set is a subset of another set. 9 - display a set 10 - Exit 7 Set complement
- specify sets to use: Complement set: (A, B, C, D, E, F, G, H, I, J)? :A Result set: (A, B, C, D, E,
F, G, H, I, J)? :F Select an option: 1 - add numbers to a set 2 - remove numbers from a set 3 -
form the union of two sets 4 - form the intersection of two sets 5 - form the difference of two sets 6
- determine if two sets are equal 7 - form the complement of an set 8 - determine if one set is a
subset of another set 9 - display a set8 Subsets - specify sets to compare: First set: (A, B, C, D, E,
F, G, H, I, J)? :A Second set: (A, B, C, D, E, F, G, H, I, J)?:B The first set is not a subset of the
second Select an option: 1 - add numbers to a set 2 - remove numbers from a set 3 - form the
union of two sets - form the intersection of two sets - form the difference of two sets - determine if
two sets are equal - form the complement of an set - determine if one set is a subset of another
set 9 - display a set 10 Exit 9 Display set (A, B, C, D, E, F, G, H, I, J)? :B {2,3,7} Select an option:
1 - add numbers to a set 2 - remove numbers from a set - form the union of two sets - form the
intersection of two sets - form the difference of two sets - determine if two sets are equal - form the
complement of an set - determine if one set is a subset of another set - display a set 10 - Exit 10