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

Answers

Answer 1

Explanation:

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}.


Related Questions

Write a program second.cpp that takes in a sequence of integers, and prints the second largest number and the second smallest number. Note that in the case of repeated numbers, we really mean the second largest and smallest out of the distinct numbers (as seen in the examples below). You may only use the headers: and . Please have the output formatted exactly like the following examples: (the red is user input)

Answers

Answer:

The program in C++ is as follows:

#include <iostream>

#include <vector>

using namespace std;

int main(){

   int n;

   cout<<"Elements: ";

   cin>>n;

   vector <int>num;

   int input;

   for (int i = 1; i <= n; i++){        cin>>input;        num.push_back(input);    }

   int large, seclarge;

   large = num.at(0);      seclarge = num.at(1);

  if(num.at(0)<num.at(1)){     large = num.at(1);  seclarge = num.at(0);   }

  for (int i = 2; i< n ; i ++) {

     if (num.at(i) > large) {

        seclarge = large;;

        large = num.at(i);

     }

     else if (num.at(i) > seclarge && num.at(i) != large) {

        seclarge = num.at(i);

     }

  }

  cout<<"Second Largest: "<<seclarge<<endl;

  int small, secsmall;

  small = num.at(1);       secsmall = num.at(0);

  if(num.at(0)<num.at(1)){ small = num.at(0);  secsmall = num.at(1);   }

  for(int i=0; i<n; i++) {

     if(small>num.at(i)) {  

        secsmall = small;

        small = num.at(i);

     }

     else if(num.at(i) < secsmall){

        secsmall = num.at(i);

     }

  }

  cout<<"Second Smallest: "<<secsmall;

  return 0;

}

Explanation:

See attachment for explanation

Which of the following describes a characteristic of organic light-emitting diodes (OLEDs) used in clothing?

uniform

flexible

transparent

sizeable

Answers

Flexible

Hopes this helps!

Answer:

Yes the answer is flexible.

Explanation:

I took the test and got it right.

Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lower even number.

Answers

Answer:

if(n % 2 == 0){

   for(int i = n; i >= 0; i-=2){

        System.out.println(i);

    }

}

else{

     for(int i = n - 1; i >= 0; i-=2){

        System.out.println(i);

     }

}

Sample output

Output when n = 12

12

10

8

6

4

2

0

Output when n = 21

20

18

16

14

12

10

8

6

4

2

0

Explanation:

The above code is written in Java.

The if block checks if n is even by finding the modulus/remainder of n with 2.  If the remainder is 0, then n is even. If n is even, then the for loop starts at i = n. At each cycle of the loop, the value of i is reduced by 2 and the value is outputted to the console.

If n is odd, then the else block is executed. In this case, the for loop starts at i = n - 1 which is the next lower even number. At each cycle of the loop, the value of i is reduced by 2 and the value is outputted to the console.

Sample outputs for given values of n have been provided above.


Landing pages in a foreign language should never be rated fully meets?

Answers

Answer:

if the landing page provides all kind information of information as to that site people usually like it or will most likely enjoy it

BRAINLIEST?????

Explanation:

How to use the RANK Function in Microsoft Excel

Answers

Answer:

=RANK (number, ref, [order])

See Explanation

Explanation:

Literally, the rank function is used to rank values (i.e. cells) in a particular order (either ascending or descending).

Take the following instances:

A column used for total sales can use rank function to rank its cells from top sales to least.

A cell used for time can also use the rank function to rank its cells from the fastest time to slowest.

The syntax of the rank function is:

=RANK (number, ref, [order])

Which means:

[tex]number \to[/tex] The rank number

[tex]ref \to[/tex] The range of cells to rank

[tex]order \to[/tex] The order of ranking i.e. ascending or descending. This is optional.

Popular periodicals might include newspapers

True or false?

Answers

Answer:

False

Explanation:

Because there is no way that would be correct!

Answer:

True

Explanation:

It makes sense

~Plz tap the crown ~

~Thank you~

Other Questions
REWARDING BRAINLIEST IF YOU DONT GET IT LMK IF YOU WANT ME TO MAKE A POST (you have to be early) OR TRY AND LOOK FOR A QUESTION NO ONE ANSWERED Which country did Hitler invade that triggered the all-out conflict in Europe?PolandGreeceSpainGreat Britain Help Asap Pls Hurry I Will Give Brainliest! Please select the word from the list that best fits the definitionThe stage in which you examine ideas, perhaps using a graphic organizer. Question ProgressHomework Progress4/Work out the size of angle x.105140 Help me on this oneIM CONFUSED!!!!!!!!!WINNER GETS BRAINLEST Find the zeros[tex]x^3+8x^2-20x+48[/tex] What was Jefferson Davis strategy for winning the civil war T/F we make synthetic materials to serve different purposes that meet our wants and needs Plot a triangle with vertices located at (4, -2) (1, -2) and (4,5) on this coordinate plane To graph the triangle, select the places on the coordinate plane to plot the vertices. Your vertices will be connected in the order that they are plotted Here is the grid. NEED HELP ASAP 15 POINTS Somebody pleassseee tell me if Im doing this right or wrong Pleassee Ikkinchi Jahon urushi qachon bo`lib o`tgan. please help me :)due today According to the chart, all of these are factors to consider when purchasing insurance and/or annuities exceptA) pay out optionsB) purpose for buyingC) age at purchase date D) taxable contributions and pay outs i failed on edg course bc of yall Which processes involve nuclear changes?A. fission and fusionB. erosion and weatheringC. combustion and oxidationD. evaporation and condensation NO LINKSArrange the events in the order in which they occurred.The Mexican-American War begins.James Polk becomes the US president.California becomes a state.General Santa Annas army attacks Texas rebels at the Alamo fort.Texan rebels declare independence from Mexico. Please help me with this homework PLEASE HELP DUE TODAY!!!!!!!1. How is the Mandate of Heaven an example of a political figure using religion to legitimize authority? 2. What would happen to a just ruler whose Dynasty experienced a famine?