Answer to Question #154052 in C++ for Junior

Question #154052

Write a program that works as follows:

Prompt the user to enter a decimal integer.

Prompt the use to select a base from 2(binary), 8(octal) and 16(hexadecimal).

Convert the decimal integer to the selected base.

Print the result. 

Sample

Input: 

123

16

Output: 

123(decimal) = 7B(hexadecimal)

 

Input: 

123

2

Output: 

123(decimal) = 1111011(binary)

 

Input: 

123

8

Output: 

123(decimal) = 173(octal)

 


1
Expert's answer
2021-01-06T05:05:07-0500
Dear Junior, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog