Question: docode: Constructing Base b Expansions MAC281 Assignment Pseudocode: Constructing Base b Expansions 1 procedure base b expansion (n. b: positive integers with b>1) 2 3

docode: Constructing Base b Expansions
docode: Constructing Base b Expansions MAC281 Assignment Pseudocode: Constructing Base b Expansions

MAC281 Assignment Pseudocode: Constructing Base b Expansions 1 procedure base b expansion (n. b: positive integers with b>1) 2 3 n 4 Sk 0 6 7 while 90 8 9 04:=qmodb 10 11 9:=qdivb 12 13 kok+1 14 15 return (base b expansion of n) Use the pseudocode above to write a C++ program that implements and tests the base conversion algorithm. The program should allow the user to enter a positive integer for n (the decimal value) and a positive integer greater than 1 for b (the base). Finally the program should print on the screen the result of the conversion. Sample output: Enter a positive integer: 52 Enter a value for the base: 2 52 = 110100 base 2 Note: You only need to make it work for bases less than 10. So it should convert to binary and octal. Extra credit: Make it work for hexadecimal conversions as well. How to submit When you are done with the C++ program copy and paste the code into a Word document (Or any text editor). Save the file as LastName.FirstName.HW2.docx Post it on Blackboard

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!