HW1.2 - ECS 50
What To Submit
changeOfBase.cpp
Prompt
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 the letters A – Z. You are guaranteed
that all values will be less than or equal to .
Input
Validity
All input will valid.
Values
Number To Convert
A number in a base between 2 and 36
Values from 10 - 35 will be represented by the letters A – Z
The letters may either be in lowercase or uppercase and may be a mix of either. Examples of valid input
AB12CD14
ab12cd14
aB12cD14
Number To Convert's Base
A value between 2 to 36
Base To Convert To
A value between 2 to 36
Program Requirements
Your program must compile without warnings when using the -Wall and -Werror options
Hints
Don't forget that you can add/subtract to from chars. For example 'a' + 1 is 'b' and 'B' + 2 is 'D'.
Examples
The examples provided here do not represent all possible input you can receive. Please make sure that you solve the
problem in the general case.
Example 1
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
Drop files here or click to upload.
Only the files listed below will be accepted—others will be ignored.
The combined size limit of all uploaded files is 5MB.
Example 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
Example 3
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
如有需要,请加QQ:99515681 或WX:codehelp