Question: Write a program that reads a string representing a hexadecimal number, converts it to a decimal equivalent, and outputs the decimal number. Directions are listed

Write a program that reads a string representing a hexadecimal number, converts it to a decimal equivalent, and outputs the decimal number. Directions are listed below:

Write a program that reads a string representing a hexadecimal number, converts

it to a decimal equivalent, and outputs the decimal number. Directions are

Write a program (called hexToDec.cpp) that reads a string representing a hexadecimal number, converts it to a decimal equivalent, and outputs the decimal number. Your program must perform the validity test for the input. Running sessions of your program might look like the following: 1h5 Enter a string representing a hexadecimal number 1h5 is not a string representing a hexadecimal number Enter a string representing a hexadecimal number => fle Hexadecial number: fle Decimal number: 3870 Enter a string representing a hexadecimal number Fe5A Hexadecial number: Fe5A Decimal number: 65114 Enter a string representing a hexadecimal number 2AEOB Hexadecial number: 2AEOB Decimal number: 175627 In your program, you must implement at least the following functions: o getInput: This function asks a user to enter a string representing a hexadecimal number, reads the string, checks the validity of the string. If the input is not valid, it informs the user and asks the user to enter again. If the input is valid, it returns the input to the caller

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 Databases Questions!