本文共 970 字,大约阅读时间需要 3 分钟。
/********************************* * 日期:2012-6-28 * 作者:SJF0115 * 题号: 九度1010 * 题目:A + B * 结果:AC * 题意: * 总结:**********************************/#include#include #include using namespace std;int ToNumber(string A){ if(A=="one") return 1; else if(A=="two") return 2; else if(A=="three") return 3; else if(A=="four") return 4; else if(A=="five") return 5; else if(A=="six") return 6; else if(A=="seven") return 7; else if(A=="eight") return 8; else if(A=="nine") return 9; else if(A=="zero") return 0; else return -1;}int main(){ string num[1000]; int i = 0; //输入重定向,输入数据将从in.txt文件中读取 //freopen("C:\\Users\\SJF\\Desktop\\in.txt","r",stdin); while(cin>>num[i]) { int num1 = 0,num2 = 0; //遇到等号停止输入 if(num[i] != "="){ i++; continue; } int j = 0; while(num[j] != "+"){ num1 = num1 * 10 + ToNumber(num[j]); j++; } while(++j
转载地址:http://rmdsi.baihongyu.com/