Please help me

Hey guys I got an assigment due but not sure how to do it, could you guys help me out?

A set is an unordered collection of distinct elements of the same type. For example,
A = {4,2,0,-1,23,17} is a set of 6 integers.
Recall from basic math that Set operations include membership, union, intersection, cardinality (and others..),

x  A : is x a member of set A?
A  B: A union B is the set of all elements that are either in A or in B or in both.
A  B: A intersection B is the set of all elements that are in both sets A and B.

For the sake of this assignment, sets will be represented by Arrays.
Write a program that initializes two sets with input from the user, then builds a new set containing their Union and another set containing their Intersection. (Note: The two functions to perform the Union and Intersection will probably need to call a function that tests on membership).
The program ends by printing both original sets, with their Union and their intersection.

You can use the following skeleton for your program:

void makeSet(int aSet[], int &size);
bool member (int el, int aSet[], int size);
void unionSet(int setA[], int a, int setB[], int b, int unionAB[], int &uab);
void intersection(int setA[], int a, int setB[], int b, int intersAB[], int &iab);
void printSet (string setName, int aSet[], int size)

int main(){
const int MAX = 10;
int setA[MAX]; // declaring a set of max size 10
int setB[MAX]; // declaring a second set of max size 10
int unionAB[2*MAX]; // declaring a set that will contain the Union
int intersAB[MAX]; // declaring a set that will contain the intersection
int a, b, uab, iab; // declaring the actual sizes of all 4 sets

makeSet(setA, a); // filling the first set and determining its size
makeSet(setB, b); // filling the second set and determining its
unionSet(setA,a, setB, b,unionAB,uab); // find the Union set and its size
intersection(setA,a, setB,b, intersAB,iab); // find the Intersection set & its size

// Printing all 4 sets
printSet("A", setA, a);
printSet("B", setB, b);
printSet("A Union B", unionAB, uab);
printSet("A Intersection B", intersAB, iab);
}
Topic archived. No new replies allowed.