I need some help/advice on solving this problem
2)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. For example, in one set A consists
of the elements
A={1 3 7 6 2 5}
and a second set B consist of the elements
B={-1 2 0 5 8 9}
then the union of the two sets would be
AUB={-1 0 1 2 3 5 6 7 8 9}
and the intersection of the two sets would be
AnB={2 5}
Write a program that will read in two arrays of integers representing the
elements of two sets from two different user-specified input files, and
calculate both the union and the intersection of the two sets. Use arrays to
contain the input sets, and also to build both the union and the 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 tww files inputA.dat and inputB.dat, containing the
following two sets
inputA=0, 1, -3, 5, -11, 6, 8, 11, 17, 15
inputB=0, -1, 3, 7, -6, 16, 5, 12, 21
If someone could help with some advice or show me how you would solve it I
would greatly appreciate it.
|