Question: #include #include #include string addhex(string, string); int main() { cout <
#include#include #include
string addhex(string, string);
int main() { cout<<"hexadecimal A4 + A5 = "< }string addhex(string hex1, string hex2) { string result = " "; // setup result int sum = 0; // setup sum int i = hex1.length() - 1, j = hex2.length() - 1; while (i >= 0 || j >= 0 || sum == 1){ sum += ((i >= 0)? hex1[i] - '0': 0); // get sum for i sum += ((j >= 0)? hex2[j] - '0': 0); // get sum for j result = char(sum % 16 + 'A') + result; sum /= 16; // get carry i--; j--; // move to next one } return result; }Please help me to fix me code, I am having problem to fix it in C++
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
