Question: Write a program in C + + that asks the user 5 binary digits. The digits will represent a binary number. Convert the binary number

Write a program in C++ that asks the user 5 binary digits. The digits will represent a binary number. Convert the binary number into decimal using the following formula: digit5+digit4\times 2+digit3\times 4+digit2\times 8+digit1\times 16
d
i
g
i
t
5
+
d
i
g
i
t
4
\times
2
+
d
i
g
i
t
3
\times
4
+
d
i
g
i
t
2
\times
8
+
d
i
g
i
t
1
\times
16
Example output is shown below (user input is in bold). You should not be using any loops or functions. You are also required to provide inline comments in your code.

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!