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.
  1. Define a map < string, int > called msi.
  2. Insert ten (name,value) pairs into it, e.g., msi["lecture"]=21.
  3. Output the (name,value) pairs to cout in some format of your choice.
  4. Erase a (name,value) pair from msi.
  5. Output the sum of the (integer) values in msi.
  6. Define a map < int, string > called mis.
  7. Enter the values of msi into mis; that is, if msi has an element ("lecture",21), mis should have an element (21,"lecture").
  8. Output the elements of mis to cout.