/*
 * mapphonebook.cpp
 *
 *  Created on: Mar 19, 2012
 *      Author: cskim
 */
#include <iostream>
#include <string>
#include <map>

#include <string>
using namespace std;

class Entry {
public:
	Entry(){
		phoneName = "";
		phoneNumber = -1;
	}
	Entry(string s, int n) {
		phoneName = s;
		phoneNumber = n;
	}
	string phoneName;
	int phoneNumber;
};
#ifndef MAPPHONEBOOK_H_
#define MAPPHONEBOOK_H_

int findMap(string fname);
string find_Map(int number);
bool insertMap(string name, int number);
bool removeMap(string name);
bool updateMap(string name, int number);
void listAllMap();



#endif /* MAPPHONEBOOK_H_ */


using namespace std;
#include "Entry.h"
#include "mapphonebook.h"

typedef map<string, int>::const_iterator CMIter;
typedef map<string, int>::iterator MIter;

map<string, int> mapPhoneBook;

int findMap(string fname){
	return mapPhoneBook[fname];
}
string find_Map(int number){


}
bool insertMap(string name, int number){
	mapPhoneBook[name] = number;
	return true;
}
bool removeMap(string name){
	MIter iter = mapPhoneBook.find(name);
	if (iter == mapPhoneBook.end())
		return false;
	mapPhoneBook.erase(iter);
	return true;
}
bool updateMap(string name, int number){
	mapPhoneBook[name] = number;
	return true;
}
void listAllMap(){
	for (CMIter i=mapPhoneBook.begin(); i!=mapPhoneBook.end(); i++) {
		cout << i->first << "  " << i->second << endl;
	}
}