联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2024-01-25 09:03

HW1.2 - ECS 50  

Click To Show The Prompt

Matthew's Stats

Time it took Matthew to complete: 15 minutes

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


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp