## Lab 10: Instructor's Notes

Chapter 13 begins with C-style arrays and sorting and searching arrays. It turns then to the Standard Template Library's `vector` container which wraps a dynamic array inside a class template and builds in some very powerful and useful operations. This lab exercise investigates this `vector` container in detail.

Here are:

• Prelab Questions designed to check if students have read through the lab exercise in preparation for doing the lab exercise. However, as noted above, they may, alternatively, be used as "postlab" exercises that test how well the students understood the lab exercise.
• I had my students work through Lab 10, but counted it as a project. They had to add the following to what they did in the lab: Second part of Project 10:

• Add a function `median()` to the library `DoubleVectorOps` from Lab 10 that finds the median of a sequence of double values. That is, add the prototype to `DoubleVectorOps.h` and also to `DoubleVectorOps.txt` with appropriate documentation; and add the definition to `DoubleVectorOps.cpp`. See Project 10.1 in the projects that go with Lab 10 for an algorithm for computing the median. Note: The instructions in Project 10.1 tell you to use the `sort()` algorithm from the standard template library to sort the vector of doubles — `sort()` is defined in the `<algorithm>` library so to use it in the definition of `median()`, you must #include `<algorithm>` in `DoubleVectorOps.cpp`.

To sort a vector `v`, we simply write:

`    `sort(v.begin(), v.end());``
Note: Your `median()` function should sort a copy of the scores vector rather than the actual scores.

• Modify the output statement in `grades.cpp` that displays the average and the standard deviation of a list of numbers so that it also displays the median of the list.
• Here is a grade sheet I used for this (modified) project.

• Other programming projects from or in addition to those in the textbook that tie in with the material in this lab exercise.
Also, a gradesheet that might be used with one of these projects.