Question: Using visual studio Create a function that takes in an unsigned int as its input and has a void output. The function will print the
- Using visual studio Create a function that takes in an unsigned int as its input and has a void output.
- The function will print the binary value of the unsigned int.
- ALGORITHM: Start with an exponent of 128.
- if (n >= exponent) { print 1; n = n exponent; }
- else if (n
- exponent = exponent / 2;
- repeat until exponent
- There is an alternative method you may consider (but may be more difficult).
- You may extract the actual bit from the unsigned int as shown on slide 47 from this week.
- Beware Endianness (ordering of bits).
- Create in your main function a prompt and read of an integer from the user (scanf).
- Pass the value the user enters to the function so its binary code is printed.
- In the attached example screenshots I attempted both methods. You do NOT have to do that. Pick a preferred method and print the binary output.
- The output should look like the pictures shown below
Enter a number less than 256: 255 ln Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
