Right Bit Shift Operator Assignment | Homework For You
February 17th, 2020
Q8. By using the right bit shift operator >> and a loop, write a function of the form
unsigned short significantBits (unsigned int num) { … }
which returns the number of bits needed to represent a given decimal number num. For example, passing the decimal number 1000 to your function should return the value 10, as the binary representation of 1000 in base 10 is equal to 1111101000 in base 2.

Q7. By using the bit-wise AND operator &, write a function of the form
unsigned char getLowerByte(int num) { … }
which takes the positive integer value num and returns the least significant (right-most) byte of the number.
Note: only one line of code is needed to implement this function. To test your function and print the value as an integer, use the following test code in your main() method: cout << “Lower byte = ” << (int)get LowerByte (OxFFFFFF) << endl; Get Finance homework help today