Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Programing problem: Hexadecimal numerals are integers written in base 16. Th

ID: 3666451 • Letter: C

Question

C++ Programing problem: 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).

Explanation / Answer

#include<iostream.h>
#include<conio.h>
int main()
{
int num1[14], num2[14],D,i;
int totalofints;
long hexarray[9];

do
{
cout << "You have Addition Overflow"<<endl;
}
while (totalofints > D)

if
{
for (int i=0;i<num1;i++)
{
cout << "Please enter your first integer number; make sure it is lower than 10 digits: ";
cin >> num1;
cout <<" " <<"These are your numbers Gererated as octal, decimal, and hexadecimal output "<<endl;
cout << uppercase<<" "
<< " octal decimal hexadecimal "
<< oct << num1 << " "
<< dec << num1 << " "
<< hex << num1 <<" "<<endl;
}
}
for(int i=0; i<num2;i++)
{
cout << "Please enter your second integer number; make sure it is lower than 10 digits:";
cin >> num2;
cout <<" " <<"This is your second number Gererated as octal, decimal, and hexadecimal output "<<endl;
cout << uppercase<<" "
<< " octal decimal hexadecimal "
<< oct << num2 << " "
<< dec << num2 << " "
<< hex << num2 <<" "<< endl;
}


totalofints=num1+num2;

cout<<"When adding your integers, your Hex result will be: "<<endl;

cout<< " hexadecimal "<< hex << totalofints << endl;

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote