course.wilkes.edu/CS125Labs
Welcome to the site for CS 125 labs!

 

Lab 11: Instructor's Notes

Prev | Next | Lab 11

This exercise introduces the student to enumeration types in C++. The exercise consists of eight parts. Note that versions of GNU C++ (g++) prior to version 2.8.0 are not sufficiently ANSI-compliant as to permit the completion of parts 4-8. If you are using a version of g++ older than 2.8.0, you should upgrade to the lastest version, as it is much more ANSI-compliant than the older versions.

In the first seven parts, the students develop a Gender enumeration. To illustate what they are to do, the exercise builds a Season enumeration as a running example.

In addition to the enumeration itself, students implement the input, output, prefix increment, postfix increment, prefix decrement, and postfix decrement operations for their new type. The students will use the files driver11.cpp, Gender.h, Gender.cpp, Gender.doc, and makefile11 in this part of the exercise.

Since defining these operations is a mechanical process for every enumeration one is likely to declare, we have provided a code-generating program "enumGenerator.cpp" that, given the desired name for an enumeration and an input file of enumerators (one per line), will generate the complete header, implementation and documentation files for such an enumeration. Students use this tool to build a Day enumeration in the final part of the exercise, introducing students to the power of an automatic code-generating tool. We also provide a simple driver program named "dayTester.cpp" that students can use to test their Day enumeration.

As always, if you wish to avoid network contention, save local copies of the required files ahead of time and instruct your students on how to access them.

Prev | Next | Lab 11

 
  Home

Help

Lab 0

Lab 1

Lab 2

Lab 3a

Lab 3b

Lab 4

Lab 5

Lab 6

Lab 7

Lab 8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13



Membership

Login




Last update: Friday, October 6, 2000 at 12:30:38 PM.
visitors to this page.