UVA 713 - Adding Reversed Numbers Solution
UVA 713 - Adding Reversed Numbers Solution '0'+'0'=96 (48+48) 48 is the ASCII value of zero. Sum of two char is 96 is means 0. Sum value 97 means 1..... Sum value 105 means 9. Sum value 106 means 10. So, result is 0 and carry is 1. which add to next chars sum. CODE: #include<iostream> #include<map> #include<algorithm> #include<string> using namespace std; int trailZero(string str) { int index=0; while(str[index]=='0') { index++; } return index; } int main() { map<char,char> charToInt; string s1,s2,s3; char ch; int i,len1,len2,max_len,carry,test; for(i=0;i<10;i++) charToInt[i+96]=i+48; cin>>te...