subject

Write functions to compute a subset, find member, union, and intersection of sets. Follow the steps below: 1. Read two integers from the user.
2. Suppose one of the integers is 2311062158. The binary equivalent of this integer stored in a register will be 1000 1001 1100 0000 0000 0010 1000 1110. This data should be regarded as bit strings representing subsets of the set {1, 2, … 32}. If the bit string has a 1 in position i, then element i is included in the subset. Therefore, the string: 1000 1001 1100 0000 0000 0010 1000 1110 corresponds to the set: {2, 3, 4, 8, 10, 23, 24, 25, 28, 32}.
3. Print out members of the set from smaller to larger. You can do a loop from 1 to 32. Load a masking bit pattern that corresponded to the position number of the loop counter (0x00000001 for 1). Isolate the bit in the operand by using the AND operation. If the result of the AND is not 0 then the loop counter is in the set and should be displayed. Increment the counter and shift the masking bit pattern to the left.
4. Read a number from the user. Determine if that element is a member of the given sets.
5. Determine the union of two sets.
6. Determine the intersection of two sets.
7. Implement a loop back to the main function. See the prompts below: "Enter the first number:" "Enter the second number:" "Members of Set 1:" "Members of Set 2:" "Enter an element to find:" "It is a member/ not a member of set 1" "It is a member/ not a member of set 2" "Union of the sets:" "Intersection of the sets:" "Do you want to compute set functions again?"
8. Test the program using the following data:

Enter the first number: 99999
Enter the second number: 111445
Members of set 1: 1 2 3 4 5 8 10 11 16 17
Members of set 2: 1 3 5 7 9 10 13 14 16 17
Enter an element to find: 7
It is not a member of set 1
It is a member of set 2
Union of the sets: 1 2 3 4 5 7 8 9 10 11 13 14 16 17
Intersection of the sets: 1 3 5 10 16 17

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Which of the following terms refers to a collection of different types of software that share the goal of infiltrating a computer and making it do something? a- malware b- virus c- spyware d- trojan horse
Answers: 2
question
Computers and Technology, 25.06.2019 00:10
Select the correct answer sarah wants to use a device to input signatures on electronic documents. which input device will be most suitable for her? a digital pen b. laser pen c keyboard d. touchscreen reset next
Answers: 2
You know the right answer?
Write functions to compute a subset, find member, union, and intersection of sets. Follow the steps...
Questions
question
Mathematics, 24.09.2019 03:30
question
German, 24.09.2019 03:40
question
English, 24.09.2019 03:40
Questions on the website: 13722360