I am doing a homework assignment for CSI 330and not sure how to begin this progr
ID: 3618653 • Letter: I
Question
I am doing a homework assignment for CSI 330and not sure how to begin this program. It is asking me toinitialize and unsigned int variable mask, with a value whosebinary representation has a 1 followed by all 0's.The second part says...
For a counter running from 1 through the number of bits do thefollowing...
a. if bitwise-and (&) if the given integer and mask is nonzeroDisplay 'I'
else
display 'O'
Shift the bits in mask one position to the right (using>>)
This is what I have so far but its just pretty much a guess...
#include <iostream>
#include <limits>
using namespace std;
//Function prototype
int printBinary();
int main ()
{
printBinary();
return 0;
}
int printBinary ()
{
for(int mask =numeric_limits <unsigned int>::digits() - 1; mask >= 0;--mask)
}
Explanation / Answer
please rate - thanks 2000 would be 10000000000000 in binary only 14 bits you need 32 bits which wouldbe 80000000 or in binary 1000 0000 0000 0000 0000 0000 0000 0000