Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE C++ and not USING std::bitset Given subsets A and B of a universal set with 10 elements (0, 1, 2, 3, 4, 5, 6,7,

USE C++ and not USING std::bitset image text in transcribed

Given subsets A and B of a universal set with 10 elements (0, 1, 2, 3, 4, 5, 6,7, 8,9), write a C++ or Java program that uses bit strings to find A U B, A n B, and A - B. Print to the screen set A, set B (be sure to print out the name of the sets), as well as the set operation results (be sure to print out the name of the operations). The program requires that elements of subsets A and B are from user input. You can make the assumption that user input numbers are within the domain of the set 0, 1, 2, ..., 9) and there is no improper input. Additional requirements and reminders: The use of STL, templates, and operator overloading is not permitted in any form. Remember: You must use a bit vector when representing a set. You may not use an array of Boolean variables. The elements of subset A and subset B must from user input. You may not hardcode the two subsets in your program. Name your file HW2.cpp or HW2.java Sample output: [ohshecs1 c2600]5 HNZ Welcome to HW 2: programming! Given subsets A and B of a universal set with 10 elements (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, we will use bit strings to find AUB, An B, and A B. Us ers will be asked to populate each set. For example, if the user enters 1, 2, 6, the bit st ring will display from left to right and display 0118001000 Please enter a number for set A Center -1 to stop):1 Please enter a number for set A Center-1 to stop) 2 Please enter a number for set A (enter -1 to stop): 6 Please enter a number for set A (enter -1 to stop): -1 Please enter a number for set B (enter -1 to stop) 2 Please enter a number for set B Center -1 to stop): 4 Please enter a number for set B (enter -1 to stop): 6 Please enter a number for set B (enter -1 to stop): 8 Please enter a number for set B (enter-1 to stop): -1 Set A: 0110001000 Set B: 0010101010 Union: 0110101010 Intersection: 0010001000 Difference 0100000000

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

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

Students also viewed these Databases questions