A+B(HDOJ)

http://acm.hdu.edu.cn/showproblem.php?pid=1228

模拟类字符串处理问题

#include 
#include 

using namespace std;

string num[]={"zero","one","two","three","four","five","six","seven","eight","nine"};

int search(string a)
{
    for(int i=0;i<10;i++)
    {
        if(num[i]==a)
        return i;
    }
}

int main(int argc, char *argv[])
{
    int result1=0,result2=0;
    string tmp;
    while(true)
    {
        while(cin>>tmp&&tmp!="+")
        {
            //cout<>tmp&&tmp!="=")
        {
            result2 =result2*10+search(tmp);
        }
        //cout<



你可能感兴趣的:(算法类)