标签:
Input
Output
Sample Input
Sample Output
#include<stdio.h> #include<string.h> char str[1024],letter[10][10]= {"zero","one","two", "three","four","five","six","seven","eight","nine"}; int flag,a,b,num; int main() { while(~scanf("%s",str)) { if(strcmp(str,"="))//不为= { for(int i=0; i<10; i++) if(!strcmp(letter[i],str))//为数字i { num=i; if(!flag) a=a*10+num;//+前,统计i else b=b*10+num; break; } if(!strcmp(str,"+")) flag=!flag;//为+ } else { if(!a&&!b)break; printf("%d\n",a+b); a=b=0;//不要忘记清零 } } return 0; }
标签:
原文地址:http://www.cnblogs.com/flipped/p/5183157.html