Reference no: EM132207705
Question :
Write a program that asks the user for an integer value (may be negative) and that outputs the bit pattern for that integer, starting with the most significant bit.
You should use an int data type which, on nearly all modern compilers, is a 32-bit value. Your output should print the decimal value, the 8-digit hexadecimal representation, and the 32-bit binary bit pattern with the bits in groups of four separated by a space.
You are required to write (and use) the function-like macro testbit(integer, position) that evaluates to true (1) or false (0) depending on if the bit in the indicated position (with 0 being the least significant bit) is a 1 or 0, respectively.
Run your program for a selection of small, moderate, and large integer values, both positive and negative, placing the results in a ReadMe.txt file.
NOTE: DO NOT to use any library functions that perform the significant tasks, such as rounding a value to the nearest cent.