Question
C PROGRAMMING HW. 1 Program must take a short integer (16-bit) from the user and write the corresponding binary number into char array by using
C PROGRAMMING HW.
1 Program must take a short integer (16-bit) from the user and write the corresponding binary number into char array by using the bit shift operations. Write the function that displays the bits as characters. You can use this prototype: void DisplayBitsAsCharacters(unsigned char Bits [], unsigned short message) Input number must be unsigned short. It means that the maximum input number is 65,535. The program must display the minimum number of digits. For example; 16-bit short integer Message1 = 127 and 16-bit binary equivalent is 0000000001111111. The program must discard the zeros which are unnecessary to express the message number and display it as 1111111. Print the Number of Digits 2 Write the function that uses the char Bits array which is generated at the function of "DisplayBitsAsCharacters, as an input argument and convert this binary number into an unsigned short integer. As a result, the program should give the same number which is entered by the user. You can use this prototype: unsigned short ConvertToDecimal(char Bits, int numberofbinarydigits)
Enter 16-bit Message-1: 127 1111111 = 127 Number of Digits: 7 Enter 16-bit Message-2: 1200 = 10010110000 1200 Number of Digits: 11 Enter 16-bit Message-3: 15345 11101111110001 15345 Number of Digits: 14 Enter 16-bit Message-4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started