Question: / * * This one takes number that is in base and converts it to new _ base * and returns the number in base

/** This one takes number that is in base and converts it to new_base * and returns the number in base 10.* The variable number will be used both to input the number and to * "return" the result. The converted number will be stored in the array * on the right side. The array will be of the given size. * The bases will could be any base between 2 and 16.* number[]- this is an array of characters that stores the number * to be converted. The index after the last character will be the * null terminated character '\0'. For example, if 10 were stored in * the array then numbers[0] would be '1', numbers[1] would be '0' and * numbers[2] would be '\0'.* This array will also be use to store the converted number. It will * start on the right. If the array is 256 indices, then number[255] will * still be '\0'. If the result of the conversion is the number 12, then * number[254] will store '2' and number[253] will store '1'.* size - this is how large the array is many digits are stored in the array. * base - this is the base of the number that is stored in the array * new_base - this is the desired new base for the number. * This function will return the number converted to base 10.*/ uint64_t convert_bases( char number[], unsigned int size, uint8_t base, uint8_t new_base ); /** This functions takes a number in base 10 and converts it to * the new base * number - this is the number you are converting * base - this is the base you want to convert number into * result - this is an array storing the result of converting the number into the * new base * It will * start on the right. The size is 256.* If the result of the conversion is the number 12, then * number[255] will store '2' and number[254] will store '1'.* size - this is the size of the array. **/ void convert_to_base( uint64_t number, uint8_t base, char result[], unsigned int size ); /** This one takes the number in the given base and converts it * to base 10* number - this is an array that is storing the individual digits from * the input as characters. The index after the last character will be the * null terminated character '\0'. For example, if 10 were stored in * the array then numbers[0] would be '1', numbers[1] would be '0' and * numbers[2] would be '\0'.* num_digits - This is how many digits are in the number array. For the * example, this would be 2.* base - this is the base for the given number * This returns the value of the number in base 10*/ uint64_t convert_to_base_ten( char number[], unsigned int num_digits, uint8_t base ); /** This function takes i as an integer and returns the character version * of that integer, for example, 1 returns '1',2 returns '2'. When the * integer is greater than 10, the letters 'A'-'F' are returned for 10-15* If the input is less than 0 or greater than 15,-1 then '\0' is * returned */ char to_char( int i ); /** This function take a character that represents a number and it returns * the integer version of that letter. For example, '0' is 0 and '1' is 1.* For the numbers in the range 0-9, when their respective letter is * given, then their respective number is returned. For inputs 'A','B',*'C','D','E', or 'F', then 10,11,12,13,14, or 15 are returned. * If something other than one of these inputs are given, then -1 is * returned. */ int to_int ( char c );

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!