25FatMouse的语言

我们都知道 FatMouse 不会说英语。但他现在已经有所准备,因为我们的国家正要加入 WTO 了。感谢图灵( Turing),我们拿计算机来帮助它们。
2.输入详细描述
输入数据先是多达 100 005 条词典条目,再输入一空行,然后是多达100 005 个单词。 每个字典条目在一行上,包含一个英文单词,后边跟着一个空格和一个 FatMouse 的语言。 FatMouse 的单词不会在词典里重复出现。信息则是 FatMouse 语言的一系列单词,一个单 词在一行上。输入数据中的每个单词是一串至多 10 个小写字母的系列。
3.输出详细描述
把信息翻译为英文输出,一个单词一行。FatMouse 的单词如果在词典里找不到,应当 输入“eh ”。
4.输入样例
dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay
atcay
ittenkay
oopslay
5.输出样例
cat
eh

loops

#include "stdafx.h"
#include<fstream>
#include<iostream>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int  _tmain(int argc, _TCHAR* argv[])
{
	map<string, string>word_m;
	map<string, string>::iterator p;
	string str1, str2, str;
	char s1[80], s2[80];
	ifstream fin("D:\\visual studio 2013 code\\test.txt");
	while (getline(fin, str1))
	{
		if (str1.size() == 0) break;
		sscanf_s(str1.c_str(), "%s %s", s1, s2);
		word_m[s2] = s1;
	}
	while (getline(fin, str2))
	{
		if (str2.size() == 0) break;
		p = word_m.find(str2);
		if (p != word_m.end())
		{
			cout << word_m[str2] << endl;
		}
		else
		{
			cout << "eh" << endl;
		}
	}
	
	return 0;
}




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值