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 20:50
What is the difference between windows 7 and windows 10?
Answers: 1
question
Computers and Technology, 23.06.2019 00:50
Representa os dados de um banco de dados como uma coleç? o de tabelas constituídas por um conjunto de atributos, que definem as propriedades ou características relevantes da entidade que representam. marque a alternativa que representa o modelo descrito no enunciado. escolha uma:
Answers: 3
question
Computers and Technology, 23.06.2019 04:40
The narrative structure of the popular movies can be broken down into
Answers: 3
question
Computers and Technology, 23.06.2019 19:40
Use a physical stopwatch to record the length of time it takes to run the program. calculate the difference obtained by calls to the method system.currenttimemillis() just before the start of the algorithm and just after the end of the algorithm. calculate the difference obtained by calls to the method system.currenttimemillis() at the start of the program and at the end of the program so that the elapsed time includes the display of the result. use the value returned by the method system.currenttimemillis() just after the end of the algorithm as the elapsed time.
Answers: 3
You know the right answer?
Write functions to compute a subset, find member, union, and intersection of sets. Follow the steps...
Questions
question
Mathematics, 27.07.2019 03:00
Questions on the website: 13722363