hdu1228 map

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
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;
    string s;
    while(1)
    {
        int x=0;
        while(cin>>s,s!="+")
        {
            x=x*10+m[s];
        }
        int y=0;
        while(cin>>s,s!="=")
        {
            y=y*10+m[s];
        }
        if(x==0&&y==0)
        break;
        printf("%d\n",x+y);
    }
    return 0;
}
    原文作者:B树
    原文地址: https://blog.csdn.net/aonaigayiximasi/article/details/79154138
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞