-
Title Description:
-
Read in two positive integers a and B less than 100, calculate a+b.
It is important to note that each digit of A and b is given by the corresponding English word.
-
Input:
The
-
test input contains several test cases, one row for each test case, the format "A + B =", and two adjacent strings with a space interval. When both A and B are at the end of 0 o'clock input, the corresponding result is not output.
-
Output:
-
Output 1 rows for each test case, which is the value of a+b.
-
Sample input:
-
One + =three four + five six =zero seven + eight nine =zero + zero =
-
Sample output:
-
39096
#include <iostream>#include<cstring>using namespacestd;intChangestringstr) { if(str=="Zero")return 0; Else if(str==" One")return 1; Else if(str==" Both")return 2; Else if(str=="three")return 3; Else if(str==" Four")return 4; Else if(str=="Five")return 5; Else if(str=="Six")return 6; Else if(str=="Seven")return 7; Else if(str=="Eight")return 8; Else if(str=="Nine")return 9;}intMain () {strings; intb; while(cin>>R) { if(s!="+"&& s!="=") A=change (s) +Ten*A; Else if(s=="+") {b=A; A=0; } Else { if(a==0&& b==0)return 0; Elsecout<<a+b<<Endl; A=b=0; } } return 0;}
1010.a+b