Question
Hexadecimal numerals are integers written in base 16. The 16 digits used are '0' through '9' plus 'a' for the digit 10, 'b' for the
Hexadecimal numerals are integers written in base 16. The 16 digits used are '0' through '9' plus 'a' for the digit 10, 'b' for the digit 11, 'c' for the digit 12, 'd' for the digit 13, 'e' for the digit 14, and 'f' for the digit 15. For example, the hexadecimal numeral d is the same as base 10 numeral 13 and the hexadecimal numeral 1d is the same as the base 10 numeral 29.
Write a C++ program to perform addition of two hexadecimal numerals each with up to 10 digits. If the result of the addition is more than 10 digits long, then simply give the output message Addition Overflow and not the result of the addition. Use arrays to store hexadecimal numerals as arrays of characters.
Your program should include and use a constant that specifies the maximum length of the numbers (10).
The program should print a string of text to the terminal before getting each line of input from the user. A session should look like one of the following examples (including whitespace and formatting), with a possibly values in the output:
Enter first number: 1a Enter second number: a1 The sum is bb.
Enter first number: 1 Enter second number: ffffffffff Addition Overflow.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started