查找之在线翻译
程序员文章站
2022-05-28 12:10:41
...
#include <iostream>
#include <memory.h>
#include <math.h>
#include <stdio.h>
#include <unordered_map>
#include <string>
#include <map>
using namespace std;
map <string,string> mymap;
int main()
{
while(1)
{
string a,b;
cin >> a >> b;
mymap[b] = a;
cin.get();//去掉行末的换行符
if( cin.peek() == '\n' )//查看是否是空行
break;
}
string temp;
while( cin >> temp )
{
if( mymap.find( temp ) != mymap.end() )
{
cout << mymap[temp] <<endl;
}
else
cout << "eh" <<endl;
}
return 0;
}
上一篇: 使用requests访问必应在线翻译
下一篇: vue 在线翻译demo