Monday, January 24, 2011

[DSA] map and set container



map<string,int> mapp;
map<string,int>::iterator mit;
string name_search;

    mapp.insert(map<string,int>::value_type("Amy",81377442));
    mapp.insert(map<string,int>::value_type("Bob",32731631));
    mapp.insert(map<string,int>::value_type("Catherine",32387163));
    mapp.insert(map<string,int>::value_type("Danny",21321312));
    mapp.insert(map<string,int>::value_type("Ecuador",54543947));
    mapp.insert(map<string,int>::value_type("Felicia",32535612));
    mapp.insert(map<string,int>::value_type("Genie",24172312));



refer to above on how the map data structure is used.


use the map data structure to satisfy the following requirements.
1. create a phone book application that can store name and phone number.
1a. perform a display all entry in the phone book.
2. phone number need to that ensure it is 8 numerical digits only.
3. initialize the phone book application with some data.
4. perform a lookup for a random entry in the phone book and display it.

challenge
5. Suggest a method to store address, email and msn address to the phone book that you have already created.
6. what are the advantages and disadvantages of your method??? explain why you choose the design.

1 comment:

Song Jong Hoon 2B05!! said...

http://snipt.net/crazyh13r0/class-3/