HOMEWORK #3 PROGRAMMING PART
(Written part will be posted soon.)
CS2134, Fall 07
Due 11:59 p.m. Thurs. Oct 11
Hand it in in a single file called hw03.cpp or a zip called hw03.zip, via the
Digital Drop Box.
In this assignment you'll modify the program from HW #2, adding some features and
changing it so the data is stored in an STL map, rather than a vector. You should
use STL iterators and algorithms as much as possible and should choose operations
that do their work efficiently.
As in HW#2, your program will have three phases,
A “batch input” phase where it inputs data about some club members from a
file, named members.txt and inserts each item into a container. In HW#2 the
container was a vector. In HW#3, the container is a map. The file format of
members.txt is the same as in HW#2.
An “interactive” phase where the user enters updates to the data. In
addition to the options in HW#2, the user can choose from among some other options,
as described below.
An output phase, where the updated output is written to a file. In HW#3 the
program will only write output to one file,
membersByID.txt, sorted by ID.
Changes to the interactive phase:
In HW#2 you could choose to use either a vector index (currentIndex) or an (vector::
) iterator (currentIterator) to point to the Object representing the member who is
currently logged in. In HW#3, you should use an (map:: )iterator for this task.
In addition to the previous menu options, the user can perform some other functions.
The interaction with the user should be done through a simple menu driven interface,
where the program prompts the user to choose a type of update, then prompts for
appropriate parameters. The new options are:
Add member: The program prompts the user to enter the ID number, last name,
first name, phone number, and e-mail address of a new club member. Normally, the
program inserts the new member into the map and outputs a “member added” message to
the terminal. If any of the data is not valid or if there is already a member with
this ID number, the program outputs a warning message and does update the map.