标签:
#include<iostream> #include<map> #include<string> #include<cstring> using namespace std; map<string,int>M; int main() { M["zero"]=0;M["one"]=1;M["two"]=2;M["three"]=3;M["four"]=4;M["five"]=5; M["six"]=6;M["seven"]=7;M["eight"]=8;M["nine"]=9;M["ten"]=10; while(1) { int A=0; char Str[10]; while(cin>>Str && strcmp(Str,"+")) { A=A*10+M[Str]; } int B=0; while(cin>>Str && strcmp(Str,"=")) { B=B*10+M[Str]; } if( A==0 && B==0 ) break; else cout<<A+B<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/FightForCMU/p/4714627.html