Question: ____________________________________________________________________________________________________________________________________________ NOTE: - You may assume the signed decimal number to be converted is always small enough to be contained in 8 bits. - All

 ____________________________________________________________________________________________________________________________________________ NOTE: - You may assume the signed decimal number to

____________________________________________________________________________________________________________________________________________

NOTE:

- You may assume the signed decimal number to be converted is always small enough to be contained in 8 bits.

- All of the binary numbers entered are represented in 2's complement form.

Write a program in VS C++ 2017 to convert a signed integer to its binary equivalent (8 bits) (in 2's complement) and vice versa. Your program should first read in either a signed integer or a binary number (always in 2's complement) provided by the user. Your program then does the necessary conversion and displays the answer to the screen. The following shows a scenario of running a sample program, where user's inputs are represented in boldface Enter your choice (1-decimal to binary, 2 -binary to decimal): 1 Enter the signed decimal number to be converted: -23 The binary equival More choice (y or n): y Enter your choice (1-decimal to binary, 2- binary to decimal): 2 Enter the binary number to be converted: 00110101 The signed decimal equivalent for the binary number 0110101 is 53 More choice (y or n): y Enter your choice (1-decimal to binary, 2 = binary to decimal): 2 Enter the binary number to be converted: 11011010 The signed decimal equivalent for the binary number 11011010 is -38 More choice (y or n): n Good bye! ent for the signed decimal number-23 is 1 1 101001

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!