using System;

  using System.Collections.Generic;

  using System.Linq;

  using System.Text;

  using System.IO;

  using System.Collections;

  namespace 英汉词典

  {

  class Program

  {

  static void Main(string[] args)

  {

  #region 加载单词

  //声明一个一个哈希表用来存储,单词与其对应的汉语翻译

  Hashtable Ht = new Hashtable();

  //读取文本

  string path = @"C:\Users\hutao\Desktop\英汉词典TXT格式.txt";

  //把每一个单词分别存放到数组内

  string[] strWord = File.ReadAllLines(path, Encoding.Default);

  //读取存放单词的数组,加载到哈希表内

  for (int i = 0; i < strWord.Length; i++)

  {

  string[] strW = strWord[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

  string StrYing = strW[0];

  //Console.WriteLine(StrYing);

  string strHan = "";

  for (int j = 1; j < strW.Length; j++)

  {

  strHan += strW[j];

  }

  if (Ht.ContainsKey(StrYing))

  {

  Ht.Remove(StrYing);

  Ht.Add(StrYing, Ht[StrYing] + strHan);

  }

  else

  {

  Ht.Add(StrYing, strHan);

  }

  //Console.ReadKey();

  }

  #endregion

  #region 查询单词

  Console.WriteLine("输入查询单词");

  string wordCh = Console.ReadLine();

  if (Ht.ContainsKey(wordCh))

  {

  Console.WriteLine("你查询的单词为{0}", wordCh);

  Console.WriteLine("汉语意思为:");

  Console.WriteLine(Ht[wordCh]);

  }

  else

  {

  Console.WriteLine("不存在此单词");

  }

  #endregion

  Console.ReadKey();

  }

  }

  }