Define a function int baseTwelveToDecimal(char t[]) that returns the decimal num
ID: 3653330 • Letter: D
Question
Define a function int baseTwelveToDecimal(char t[]) that returns the decimal number corresponding to the base12 number t. For example if t is "AB85" then baseTwelveToDecimal(t) will return 18965. Use the following algorithm: Declare an int variable temp to store partial results. Initialize temp to 0, then scan t from left to right. For each new base 12 digit (a '0' , '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A' or 'B') multiply temp by 12 and add the value represented by that base 12 digit (0 ,1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 11).Explanation / Answer
// This program converts any number from base x to base y. It prompts the // user for the number, base x and base y and then converts the base x to // base y. #include "stdafx.h" #include using namespace std; void baseYConverter(int num2); int main() { // declare variables int num1, num2, num3; // get user number, base x and base y while (true) { cout > num1 >> num2 >> num3; if (num2 >= 2 && num2 = 2 && num3Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.