CPSC 221H-200: Data Structures & Algorithms
Lab Exercise #3
Spring 2009
Drill adapted from "Programming: Principles and Practice in C++" by Bjarne Stroustrup pg 764
After each operation (as defined by a line of this drill) print the map.
- Define a map < string, int > called msi.
- Insert ten (name,value) pairs into it, e.g., msi["lecture"]=21.
- Output the (name,value) pairs to cout in some format of your choice.
- Erase a (name,value) pair from msi.
- Output the sum of the (integer) values in msi.
- Define a map < int, string > called mis.
- Enter the values of msi into mis; that is, if msi has an element ("lecture",21), mis should have an element (21,"lecture").
- Output the elements of mis to cout.