map

// map.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <map>

using namespace std;
typedef pair<int, int> mine;
int _tmain(int argc, _TCHAR* argv[])
{
    map<int, int> ap;
    map<int, int>::iterator it;
    ap.insert(map<int, int>::value_type(3, 5));
    ap.insert(map<int, int>::value_type(6, 9));
    ap.insert(map<int, int>::value_type(4, 9));
    //ap.insert(mine(300, 12));
    for (it = ap.begin(); it != ap.end();it++)
    {
        cout << "hh";
        //it++;
        cout << "key:" << it->first
            << "value:" << it->second << endl;
    }
    getchar();
    return 0;
}


posted @ 2017-08-28 19:21  倾耳听  阅读(152)  评论(0编辑  收藏  举报