Files to submit: changeOfBase.cpp Time it took Matthew to complete: ?
• All programs must compile without warnings when using the -Wall and -Werror options
• Submit only the files requested
◦ Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc • If submitting in a group on Grade Scope please make sure to mark your partner.
◦ Only one of you has to submit there
• Your program must match the output exactly to receive credit.
◦ Make sure that all prompts and output match mine exactly.
◦ Easiest way to do this is to copy and paste them
• All input will be valid unless stated otherwise
• Print all real numbers to two decimal places unless otherwise stated
• The examples provided in the prompts do not represent all possible input you can receive.
• All inputs in the examples in the prompt are underlined
◦ You don’t have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
• If you have questions please post them on Piazza
Write a C++ program called changeOfBase.cpp that converts an integer number from one base to another. The program should ask the user for the current base, the number in that current base, and the new base to be converted to. Valid bases are between 2 and 36. Values of digits from 10 – 35 will be represented by characters A – Z. You are guaranteed that all values will be less than or equal to 2^(32) – 1.
Hints
1. Don’t forget that you can add/subtract to from chars. 1. For example ‘a’ + 1 is ‘b’ and ‘B’ + 2 is ‘D’
Examples
1.
2.
3.
Please enter the number’s base: 10
Please enter the number: 25
Please enter the new base: 2
25 base 10 is 11001 base 2
Please enter the number’s base: 6
Please enter the number: 405
Please enter the new base: 19
405 base 6 is 7G base 19
Please enter the number’s base: 24
Please enter the number: GIG
Please enter the new base: 10
GIG base 24 is 9664 base 10