C++ hash_map小例子

#include <vector>
#include <boost/progress.hpp>
#include <Windows.h>
#include <map>
#include <iostream>

#include <hash_map>

#include "CSHOW.H"
using namespace boost;
using namespace std;

int main()
{
 hash_map<string, int> student;
 student.insert(pair<string, int>("ganquanfu" ,98));
 student.insert(pair<string, int>("zhouxiaojie" ,88));

 //cout << student["ganquanfu"] << endl;
 //cout << student["zhouxiaojie"] << endl;


 hash_map<string, int>::iterator hpItem;
 for (hpItem = student.begin(); hpItem != student.end(); ++hpItem)
 {
  cout << hpItem->first << "  " << hpItem->second << endl;
 }
 
 int wait;
 cin >> wait;
}

 

posted @ 2013-06-28 21:25  Predator  阅读(321)  评论(0编辑  收藏  举报