[ create a new paste ] login | about

Link: http://codepad.org/Bu5YRFFx    [ raw code | output | fork ]

hecomi - C++, pasted on Jul 17:
#include <iostream>
#include <map>
#include <string>

int main()
{
	using namespace std;
	map<int, string> names;
	names.insert(pair<int, string>(5, "Kubotatata"));
	names.insert(pair<int, string>(3, "nebucchi"));
	names.insert(pair<int, string>(10, "hecomi"));
	names.insert(pair<int, string>(7, "yuki_B"));
	names.insert(pair<int, string>(1, "yukkury"));
	
	map<int, string>::iterator it = names.begin();
	while (it != names.end()) {
		cout << (*it).second << endl;
		it++;
	}

	map<string, int> names2;
	names2.insert(pair<string, int>("Kubotatata", 5));
	names2.insert(pair<string, int>("nebucchi", 3));
	names2.insert(pair<string, int>("hecomi", 10));
	names2.insert(pair<string, int>("yuki_B", 7));
	names2.insert(pair<string, int>("yukkury", 1));
	
	cout << names2["nebucchi"] << endl;

	return 0;
}


Output:
1
2
3
4
5
6
yukkury
nebucchi
Kubotatata
yuki_B
hecomi
3


Create a new paste based on this one


Comments: