Algoma University College
COSC 1047 -
INTRODUCTION TO COMPUTER SCIENCE II
Winter 1996/97 -
Monday and Wednesday 5.30 PM
Assignment #3
INSTRUCTOR: Pawan J. Lingras
-
Change the database class from previous assignment to a template.
The template accepts the size of the database as a parameter.
Write input and output operators for the database to
read/write from/to a file.
The first line in the file will be the number of records in the database.
The format of each record in the file is as follows:
username first_name last_name
Test the template by modifying the driver program from the third
part of assignment #2.
-
Create a descendant of the database template with an additional data member
called current.
The default constructor sets current to 0.
Additional function members include:
void reset(); to reset current to 0.
user_type operator[](string name);
void finger(string name);
Overloaded index operator returns the first record starting from current
that matches "name". The match may be on any one of the three fields.
The current is set to the index of found record.
An exception "not_found" is thrown if the record is not found.
finger(string name) prints all the records matching "name".
The match may be on any one of the three fields. The function
should use overloaded index operator.
Modify the previous driver to test new functions.