Question: Q8. By using the right bit shift operator >> and a loop, write a function of the form unsigned short significantBits (unsigned int num) {

 Q8. By using the right bit shift operator >> and a
loop, write a function of the form unsigned short significantBits (unsigned int

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!