In set theory, the union of two sets is the list of all elements that appear in
ID: 3635453 • Letter: I
Question
In set theory, the union of two sets is the list of all elements that appear in either (or both) of the sets., and the intersection of the two sets is the list of all elements that appear in both sets only .A consists of the elements
A {1, 3,7, 6, 2 ,5 }
B consist of the elements
B { -1, 2, 0, 5, 8, 9}
A union B {-1, 0, 1, 2, 3, 5, 6, 7, 8, 9
A intersection B { 2, 5 }
Write a program in C++ that reads in two arrays of integers representing the elements of two sets from two different user-specified input files and calculates both the union and the intersection of the two sets. Use arrays to contain the input sets and build both the union and intersection. Note that the input sets may not be sorted in order, so your algorithm must work regardless of the order in which set elements are entered.
Test your program on two files
inputA. dat 0, 1, -3, 5, -11, 6, 8, 11,17,15,7,12
inputB. dat 0, -1, 3, 7, -6, 16, 5, 12, 21
PROJECT 6
Algorithm:
Populate arrays using two input files.
Prompt user for file names.
Create files with numeric data, i.e. numbers without commas.
Find union of files
Remove duplicates
Find intersection
No duplicates are allowed in intersection or union.
Explanation / Answer
#include using namespace std; class IntegerSet { public: IntegerSet()//default constructor { int num; for ( aArray[num]; numRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.