示例#1
0
int main(int argc, char *argv[])
{
  StrStrMap dict;
  dict.insert(make_pair("day", "Tag"));
  dict.insert(make_pair("strage", "frem"));
  dict.insert(make_pair("Cat",  "Auto"));
  dict.insert(make_pair("smart", "elegant"));
  dict.insert(make_pair("trait", "Merkmal"));
  dict.insert(make_pair("smart", "something"));

  StrStrMap::iterator pos;
  cout.setf(ios::left, ios::adjustfield);
  cout << ' ' << setw(10) << "english" << "german" << endl;
  cout << setfill('-') << setw(20) << ""
       << setfill('-') << endl;
  for(pos = dict.begin(); pos != dict.end(); ++pos)
    cout << ' ' << setw(10) << pos->first.c_str()
	 << pos->second << endl;
  cout << endl;

  string word("smart");
  cout << word << endl;
  for(pos = dict.lower_bound(word); pos != dict.upper_bound(word); ++pos)
    cout << " " << pos->second << endl;

  cout << "=================Testing Find ===============" << endl;
  test_find();
  return 0;
}