ok so i need to allow the user to enter a number they want or delete that number from an array. Then i need to combine those arrays(union) and then find out which elements are common(intersection). only numbers 0-100 are allowed to be entered. so if an element is in the array it is set to 1 and if it is not in the array it is set to 0. what i am stuck at is how to do the union and intersection. any hints or help on where to start? also did i do the delete and insert functions correctly?

``````#include <iostream>
using namespace std;

class IntegerSet
{
public:
IntegerSet()//default constructor
{
int num;
for ( aArray[num]; num <= 101; num++)
{
aArray[num] = 0;
/*cout << "a[" << num << "] = " << aArray[num] << endl;*///just to make sure the elements were initialized to zero/empty set
}
}

void unionOfSets()
{

}

void intersectionOfSets()
{
}

void insertElement(int num)
{
aArray[num + 1] = 1;
}

void deleteElement(int num)
{
aArray[num + 1] = 0;
}

{
int element;
do{// do while continues to ask user to enter elements until they want to stop
cout << "Which number(0-100) would like to add to the set? Enter -1 to stop";
if (element != -1)
{
cin >> element;
}
else
{
break;
}
}while (element != -1);

return element;
}

private:
int aArray[101];
};
int main()
{

IntegerSet setA;
IntegerSet setB;
/*IntegerSet setC = setA.unionOfSets(setB);
IntegerSet setD = setB.intersectionOfSets(setA);*/

return 0;
}``````

> what i am stuck at is how to do the union and intersection. any hints or help on where to start?
union = if it's in either, then set the result
intersection = if it's in both, then set the result.

The rest is just for loops.

> what i am stuck at is how to do the union and intersection. any hints or help on where to start?
union = if it's in either, then set the result
intersection = if it's in both, then set the result.

The rest is just for loops.