Objective:
Program with a Database File
Preparation:
Review Chapter 12 from Starting Out with C++ by Gaddis
Programming:
- You will place all your code in one file. Name the file LlllFfffLab07.cpp where Llll is the first four letters of your last name and Ffff is the first four letters of your first name.
- Write a database program that deals with a database file of student records. The database
file will be a random-access file of binary data. Each student record should consist
of last name, first name, age, and gpa fields in that order. The last name and first
name will be c-strings (character arrays) of 20 and 15 characters respectively. The
age will be an int and the gpa will be a double. Use a structure to represent the
record. The program should allow the user to specify the name of the database file.
It should open the file for both input and output. The program should not read all
data into memory, instead it should interact with the file dealing with one record
at a time as necessary. The file may or may not exist initially. If it does not initially
exist, it will need to be created.
- The program should be menu-driven with the following options:
- Display Summary List of Entries
- Display an Entry
- Add an Entry
- Edit an Entry
- Quit.
- The Summary List of Entries option should read all records one at a time displaying
on the monitor a numbered list of last names. The Display an Entry option should display
the complete record of a given entry based on the number of the entry. The Add an
Entry option will add a new entry to the end of the file. The Edit an Entry should
allow the user to change any/all fields of a chosen record. Each option should interact
with the file reading the data as necessary and writing any data as necessary for
that option. (We will not deal with deleting an entry.)
- Verify your program works correctly.
- Submit your source code file to
ude.wons@nosneros.htrag. Due at 8:00 am on 18 February.