Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8066273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:55:58+00:00 2026-06-05T11:55:58+00:00

Consider a situation, in which the following function is required: convert(val1, base1, base2) It

  • 0

Consider a situation, in which the following function is required:

convert(val1, base1, base2)

It converts a number (val1) from base1 number system to base2 number system. In this function, all arguments are strings, e.g.

convert("34", "012345", "01234567890ABCDEF") 

Is called in order to convert 346 -> X16.

When I started thinking of implementation, it came obvious that converting a number with a bigger base to a smaller one requires division operation defined for numbers in the bigger base, e.g. 1210 -> X2 = 12 / 2 | 6 / 2 | 3 / 2 | 1 / 2 | = 11002.

The next though was about doing 2-step-conversion Xb1 -> X10 -> Xb2. This would be definitely easier to implement, but guys, can you please confirm that I’m not wrong in previous conclusion, or is there a clear way to implement such convert() function without an intermediate to-decimal conversion?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:56:01+00:00Added an answer on June 5, 2026 at 11:56 am

    Assuming you’re looking for a practical solution in a computer program, you don’t want to convert to base 10 as an intermediate, but instead convert to the computer’s native representation, the base of which is irrelevant. Write two separate functions, one to parse a string into an integer, the other to convert an integer to a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets consider the following situation. There is products_controller which can be accessed from Admin
Consider the following situation: I have two android projects named P1 and P2 which
Consider the following situation. I've 2 types of backgrounds: 1.Photoshop gradients for which I
Consider a situation in which you need to call successive routines and stop as
Consider the following situation Code was added to the trunk at revision x A
Consider the following situation: WidgetCompany produced a .NET DLL in 2006 called Widget.dll, version
Consider the following situation: We have two Localizable.string files, one in en.lproj and one
Consider this scenario: I've an XML file called person.xml with the following data in
Consider the following situation: SomeType *sptr = someFunction(); // do sth with sptr I
Consider the following hypothetical people management system. Suppose each Person object belong to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.