Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with set theories in c++ With the help of package set , create a program which is capable of assembling and displaying various

Need help with set theories in c++

With the help of package

set

, create a program which is capable of assembling and displaying

various sets.

The program must correctly display the result of operators on sets (such as Union and

Intersection), and in addition it must do the following two things:

First, it must NOT repeat any values that might appear more than once. So if you Union two sets

together that each have the number

5

somewhere in them, then

5

should only appear ONCE in

the resulting set.

Second, if the resulting thread is empty

, your program must indicate the empty thread in some

recognizable manner

, such as displaying

Empty

or

E

or something similar

Below are the threads you will use. Also assume that the A group comprises 'reality' so to speak,

the numbers 1-10 being all elements possible, such that the INVERSE of A, is the empty thread.

Thus if you were asked to compute the INVERSE of B, it would be equivalent to saying "Set A

minus Set B". For this exercise, we will represent inverse with the

N()

indicates the SIZE of the resulting set. So if you have a set such as

A =

{1,3,7,10}

then

N(A) = 4

. For problems asking for

N(), your result should be a single

number indicating the resulting set's size

A = {1,2,3,4,5,6,7,8,9,10}

B = {2,4,6,8,10}

C = {1,3,5,7,9}

D = {1,2,3,5,7}

A D

Problem 2.)

( B C ) A

Problem 3.)

(!C C) A

Problem 4.)

A D

Problem 5.)

N(!A ( C D))

Problem 6.)

D C

Problem 7.)

N(B C)

Problem 8.)

A B C D

PLease use this starting code

#include

#include

using namespace std;

void show_set(set set1)

int show_set_size(set set1)

set SetUnion(set set1, set set2);

set SetIntersection(set set1, set set2);

set SetSub(set set1, set set2);

set SetInverse(set set2);

int main(){

set setA;

/* create set A */

set setB;

/* create set B */

set setC;

/* create set C */

set setD;

/* create set D */

cout << "The answer of Problem 1 is ";

/* your codes for Problem 1 */

cout << "The answer of Problem 2 is ";

/* your codes for Problem 2 */

cout << "The answer of Problem 3 is ";

/* your codes for Problem 3 */

cout << "The answer of Problem 4 is ";

/* your codes for Problem 4 */

cout << "The answer of Problem 5 is ";

/* your codes for Problem 5 */

cout << "The answer of Problem 6 is ";

/* your codes for Problem 6 */

cout << "The answer of Problem 7 is ";

/* your codes for Problem 7 */

cout << "The answer of Problem 8 is ";

/* your codes for Problem 8 */

return 0;

}

void show_set(set set1) {

if (/* TO BE COMPLETED */)

{

cout << "This set is empty." << endl;

}

else

{

cout << "This set contains: ";

/* TO BE COMPLETED */

}

}

int show_set_size(set set1) {

/* TO BE COMPLETED */

}

set SetUnion(set set1, set set2) {

/* TO BE COMPLETED */

}

set SetIntersection(set set1, set set2) {

/* TO BE COMPLETED */

}

set SetSub(set set1, set set2) {

/* TO BE COMPLETED */

}

set SetInverse(set set2) {

/* TO BE COMPLETED */

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions