ACM1228_STL的应用

时间:2022-12-16 19:44:00
ACM1228_STL的应用
#include<iostream>
#include<string>
#include<map>
using namespace std; map<string ,int> mp; void setMap()
{
mp["zero"] = ;
mp["one"] = ;
mp["two"] = ;
mp["three"] = ;
mp["four"] = ;
mp["five"] = ;
mp["six"] = ;
mp["seven"] = ;
mp["eight"] = ;
mp["nine"] = ;
}
int main ()
{
setMap ();
int sum;
string a,b;
string filter;
while(cin>>a)
{
sum=;
cin>>b;
if(b!="+")
{
sum+=mp[a]*+mp[b];
cin>>filter;
}
else
{
sum+=mp[a];
}
cin>>a>>b;
if(b!="=")
{
sum+=mp[a]*+mp[b];
cin>>filter;
}
else
{
sum+=mp[a];
}
if(sum == )
{
break;
}
else
{
cout<<sum<<endl;
}
}
return ;
}