Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INSTRUCTION PLEASE USE THIS FOLLOWING CODE BELOW TO COMPLETE #include #include using namespace std; void show_set(setint> set1); int show_set_size(setint> set1); setint> SetUnion(setint> set1, setint> set2);

INSTRUCTION

image text in transcribed

PLEASE USE THIS FOLLOWING CODE BELOW TO COMPLETE

#include

#include

using namespace std;

void show_set(setint> set1);

int show_set_size(setint> set1);

setint> SetUnion(setint> set1, setint> set2);

setint> SetIntersection(setint> set1, setint> set2);

setint> SetSub(setint> set1, setint> set2);

setint> SetInverse(setint> set2);

int main(){

setint> setA {1,2,3,4,5,6,7,8,9,10};

setint> setB {2,4,6,8,10};

setint> setC {1,3,5,7,9};

setint> setD {1,2,3,5,7};

cout

/* your codes for Problem 1 */

cout

/* your codes for Problem 2 */

cout

/* your codes for Problem 3 */

cout

/* your codes for Problem 4 */

cout

/* your codes for Problem 5 */

cout

/* your codes for Problem 6 */

cout

/* your codes for Problem 7 */

cout

/* your codes for Problem 8 */

return 0;

}

void show_set(setint> set1) {

if (1)

{

cout

}

else

{

cout

/* TO BE COMPLETED */

}

}

int show_set_size(setint> set1) {

/* TO BE COMPLETED */

}

setint> SetUnion(setint> set1, setint> set2) {

/* TO BE COMPLETED */

}

setint> SetIntersection(setint> set1, setint> set2) {

/* TO BE COMPLETED */

}

setint> SetSub(setint> set1, setint> set2) {

/* TO BE COMPLETED */

}

setint> SetInverse(setint> set2) {

/* TO BE COMPLETED */

}

Assignment: 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 ! symbol. (100pts total: 60 for program, 5 per problem) In this assignment, NO) 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 NO), your result should be a single number indicating the resulting set's size. Finally, a basic hint to help with this assignment: You may find arrays to be useful. A = {1,2,3,4,5,6,7,8,9,10} B = {2,4,6,8,10} ( = {1,3,5,7,9} D = {1,2,3,5,7} CHECKPOINT this is your attendance for 1/15 & 1/22 Create two functions, the first can display your set, and the second can display the size of your set. Test the two functions on set A showing above. Problem 1.) A n D Problem 2.) ( BUC) nA Problem 3.) (!C u C) A A Problem 4.) A - D Problem 5.) N(!A U (CUD)) Problem 6.) Dn C Problem 7.) NCB n C) Problem 8.) A U BUCUD In this assignment, you are supposed to use only one cpp file, and print all the answers on the screen

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions