stl map

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

#include "stdafx.h"
#include <string>
#include <process.h>
#include <iostream>
#include <map>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	map<int,string> mapStudent;
	mapStudent.insert(map<int,string>::value_type(1,"郑金玮"));
	mapStudent.insert(make_pair(2,"天策"));

	typedef map<int,string>::iterator mapIt;
	mapIt start=mapStudent.begin();
	mapIt end=mapStudent.end();
	for (;start!=end;start++)
	{
		cout<<start->first<<"----"<<start->second<<"----"<<endl;
	}
	 
	system("pause");
	return 0;
}

你可能感兴趣的:(map)