Lab

Set & Map


Prelab Task:

    1. Reviewed the contents we learned about set and map.

Lab Task:

In this lab, we will use set and map data associated data structures to store state and city names and perform the search.

  1. Read and understand d_set.h and d_map.h. You may include <set> and <map> header files for your lab part 3 and 4 respectively. In that case, you can assume the member functions for set and map are the same as those defined in d_set.h and d_map.h. 
  2. Copy d_state.h to your working directory and finish its implementation.
  3. Write a program:

  4.  In this part, rather than using objects of type stateCity, you will implement the program by using a map with state name (string) as the key and the city name (string) as the data value.

5. Name the program in the part 3 as lab06_set.cpp and the program in part 4 as lab06_map.cpp

6. Compare your outputs for programs lab06_set.cpp and  lab06_map.cpp with the sample output.

7. Demo your programs to the instructor.

What to Turn In:

Hand in the source codes for d_state.h,  lab06_set.cpp and  lab06_map.cpp and sample outputs to the instructor.