Lab 3a: Instructor's Notes


Since chapter 3 in the text is fairly long, we have provided two lab exercises for it: 3a and 3b. In exercise 3a, students build a separately compiled library of metric conversion functions (simple, but useful). In exercise 3b, students learn to build more complicated functions that require selective and repetitive behavior. We have our students do both exercises, 3a one week and 3b the next.

Using a user-defined, separately compiled library with a program changes translation to a multi-step process:

  1. each source file is compiled to create an object file (ending in .o).
  2. The object files are then linked to create a binary executable program.
Coordinating separate compilation is the role of the Project in Visual C++. Each source file (i.e., driver.cpp and metric.cpp) must be added to the project, but not the header files (i.e., metric.h).

We provide "starter" files in the exercise for each of the components in the lab exercise: driver.cpp, metric.h, metric.cpp, and metric.doc. If you wish to avoid network contention and traffic, save all of these files ahead of time in a 3a folder of your course folder, and instruct your students to copy them from there.


Back to This Lab's Home Page

Forward to the Prelab Questions


Copyright 1998 by Joel C. Adams. All rights reserved.