Explore BrainMass

Explore BrainMass

    C++ program to do base conversion

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I am trying to write a C++ program that will convert any base 10 number v to any base b. It reads in two values at a time, from a file, the first is the base 10 number and the second value is the base that the base 10 number v is to be converted to, and then it prints the results to an output file. The base can only be between 2 and 9, and any invalid input should be flagged as invalid.

    I am trying to write the code as a function to be called in from the main function, so there is little code in the main.

    Attached Word file (named as "Base Conversion File.dat") gives the data to be used as input.

    © BrainMass Inc. brainmass.com December 24, 2021, 9:22 pm ad1c9bdddf


    Solution Preview

    Please find attached an implementation 371335.cpp that has been tested for warning free compilation, using "g++ -Wall 371335.cpp", and correct working, using ...

    Solution Summary

    Program makes use of macros INPUT_FILE_NAME and OUTPUT_FILE_NAME to refer to input and output files respectively.