Question: A 0 : Base to Decimal Learning Outcomes - - - - - - - - - - - - - - - - -
A: Base to Decimal
Learning Outcomes
Explain the difference between characters and numbers on a computer.
Use an array as a lookup table to check for character equality.
Use an algorithm to translate a number from a different base to decimal.
Develop a program that utilizes this algorithm.
Specifications
For this assignment you will write a program that can convert numbers written in bases to into their decimal equivalents. The numbers will be prefixed with bqsnz and x for example, indicting which base the given input is in
There's no need to write any code outside of lines inside main and the charstoint function. this is a preprocessor directive
#include
this is a function prototype
int charstointchar int;
const char bases btqpshondlzrfyx";
this is the main function
int mainint argc, char argv
output usage if incorrect number of command line
arguments were given
if argc
printfusage: s btqpshondlzrfyx
argv;
return ;
chars is an array of characters
char chars argv;
TODO: call charstoint with correct arguments
TODO: output an error if charstoint
encountered an error
print the result
printfd
;
exit succefully
return ;
int charstointchar chars int base
TODO: implement this function to translate
an array of characters to a decimal number
TODO: return the result
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
