Question: Write a program in Visual Studio C++ 2017 to convert an unsigned integer to its binary equivalent and vice versa. Your program should first read
Write a program in Visual Studio C++ 2017 to convert an unsigned integer to its binary equivalent and vice versa. Your program should first read in either an unsigned integer or a binary number 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 unsigned decimal number to be converted:
23
The binary equivalent for unsigned decimal number 23 is 10111
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:
0110101
The unsigned decimal equivalent for binary number 0110101 is 53
More choice (y or n):
n
Good bye!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
