Help with C++ program!!! Write a program that will convert any base 10 number v
ID: 638443 • Letter: H
Question
Help with C++ program!!!
Write a program that will convert any base 10 number v to any base b. Input two values, the first is the base 10 number and the second value is the base that the base 10 number v is to be converted to. The base can only be between 2 and 9. Flag invalid input and prompt user again.
Test 1: Test your program with the value 191 for each base 2 to 9.
Test 2: Test your program by printing out all ASCII values (all 128 of them) in binary.
The conversion algorithm
1. Set k to the number of digits needed in the converted number. k = floor(log(v)+1) or k = floor(log10(v)/log10(b))+1.
2. Print digit (v/b k-1)) most siginificant remaing digit.
3. Set v to v% (bk-1) the remaining part of the base 10 digit.
4. Subtract 1 from k (reduce the power on the base by one) Implementation poition = position/base.
Explanation / Answer
i tried in c#....hope it hepls
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.