I need to test for overflow and I think I have the code right. What I want to do is convert 2 base 10 numbers to 16 and check for overflow. To do this, I need to add each leading number and if greater than 15 then overflow occurs, right?
Numbers are numbers. What base they're in is a moot point -- they're stored the same way in the computer regardless. Ten is ten no matter what base you're in.
The "base" only comes in to play when you convert the number to text for printing.
1 2 3 4 5 6
int number = 31; // thrity-one
cout << number << endl; // prints thirty-one in base 10: "31"
cout << hex << number << endl; // prints thirty-one in base 16 "1f"
// no conversion necessary. The number is the same.