// 30_30-8.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <string>
#include <map>

using namespace std;

void disp(map<string, int> &obj)
{
	map<string, int>::iterator p;
	for (p = obj.begin(); p != obj.end(); p++) {
		cout << "(" << p->first << "," << p->second << ")";
	}
	cout << '\n';
}

int _tmain(int argc, _TCHAR* argv[])
{
	map<string, int> m1;
	map<string, int>::iterator p, p1, p2;
	map<string, int>::reverse_iterator rp;

	cout << "-----(1)pairで要素を設定する\n";
	m1.insert(pair<string, int>("ezaki", 111));
	m1.insert(pair<string, int>("chiba", 333));
	m1.insert(make_pair("asada", 222));
	cout << "m1の長さ=" << m1.size() << '\n';

	cout << "-----(2)反復子処理でm1内容を表示\n";
	for (p = m1.begin(); p != m1.end(); p++) {
		cout << "(" << p->first << "," << p->second << ")";
	}
	cout << '\n';
	cout << "-----(3)逆進反復子処理でm1内容を後ろから表示\n";
	cout << "-----(4)m1の先頭〜chibaまででm2を初期化\n";
	cout << "-----(5)m1をクリアする\n";
	cout << "-----(6)添字処理で要素を設定する\n";
	cout << "-----(7)添字処理で要素を更新する\n";
	cout << "-----(8)chibaを検索して番号表示\n";
	cout << "-----(9)okada(存在しない)を検索して番号表示\n";
	cout << "-----(10)chibaとokadaの登録数を表示\n";
	cout << "-----(11)chibaをcount()で存在確認して番号表示\n";
	cout << "-----(12)m2にm1をコピー\n";
	cout << "-----(13)m2のezakiをfind+eraseで削除\n";
	cout << "-----(14)m2のchibaをcount+eraseで削除\n";




	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

