Question: Write 4 functions that will complete the program. First 2 functions I already wrote program will enter data into two single dimension arrays (no duplicate

Write 4 functions that will complete the program.

First 2 functions I already wrote

program will enter data into two single dimension arrays (no duplicate values in arrays)

program will find the union and intersection of the two arrays

program will display the union and intersection

No subscripts are permitted in any function for this program including the inputData and displayData functions. You must use pointers to access dynamically allocated arrays and to control loop termination.

Code given by professor

#include #include // header file required for dynamic allocation of memory using namespace std;

void inputData(short *data, short size); // function to enter data into the array void displayData(short *data, short size); // function to display data in an array void get_union(short *set1, short size1, short *set2, short size2, short *union_array, short size_union); short *get_intersection(short *set1, short size1, short *set2, short size2, short *intersection, short size_intersection);

int main() { short *set1, size1, // first data set and size; do not put duplicate values in the data set *set2, size2, // second data set and size *union_array, size_union, // array to store the union of the two sets *intersection, size_intersection; // array to store the intersection of the two sets cout<<"Program will find the union and intersection of two sets of data "; cout<<"enter the number of values to store in the data set 1 or zero to terminate the program "; cin>>size1; while(size1) // loop to permit user to test many data sets { set1 = new(nothrow)short[size1]; // test pointer to verify memory was allocated if(!set1) { cout<<"Memory allocation error, program will terminate "; system("pause"); exit(0); } inputData(set1, size1); // print the contents of the array cout<<" there are "<

void inputData(short *data, short size) // function to enter data into the array

{

short count=1;

short *end=(data+size);

for( ;data

{

cout<<"Enter Number "<

cin>>*data;

cout<

}

}

void displayData(short *data, short size) // function to display data in an array

{

short count;

short *end=(data+size);

for(;data

{

cout<<"Number "<

}

}

void get_union(short *set1,short size1,short *set2,short size2,short *union_array,short size_union) // look at call statement to assist in completing this statement

{

}

short *get_intersection(short *set1, short size1, short *set2, short size2, short *intersection, short size_intersection) // look at call statement to assist in completing this statement

{

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!