标签:字符 one 整数 font str namespace ane hang content
one + two = three four + five six = zero seven + eight nine = zero + zero =
3 90 96
#include<iostream> #include<cstring> using namespace std; int change(string str){ if(str=="zero") return 0; else if(str=="one") return 1; else if(str=="two") 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; } int main(){ string s; int a,b; while(cin>>s){ if(s!="+" && s!="=") a=change(s)+10*a; else if(s=="+"){ b=a; a=0; } else { if(a==0 && b==0) return 0; else cout<<a+b<<endl; a=b=0; } } return 0; }
标签:字符 one 整数 font str namespace ane hang content
原文地址:https://www.cnblogs.com/bernieloveslife/p/9736505.html