Cmpe 352 lab 2 Fixed Length Records




Yüklə 5.51 Kb.
tarix10.04.2016
ölçüsü5.51 Kb.

CMPE 352 LAB 2

Fixed Length Records


Week of March 10 and March 17, 2008

To be done in groups of 2. Pick your partner! However, you will individually be asked to answer questions about your program.


This lab, as well as the next few labs that follow, are designed to give you experience with low level file manipulation in an imperative language such as 'C' or C++, as well as the different ways of organizing data in files.
Write a program in 'C' or C++ that maintains a file of records for a university. Each record shall keep information about one student and will have the following structure:

Student_no: 6 characters

Student_name: 20 characters

Gender: 1 character


Department : 4 characters
Place_of_Birth: 10 characters

Country: 10 characters

CGPA: Float

Each record shall have exactly the same number of bytes in it. Your program should have a simple menu with the following commands:



  1. Insert Record

  2. Delete Record (will ask for the Student_no)

  3. List all the records (will show the records on the screen)

  4. Exit

When you delete a record, all remaining records that come after the one you deleted should be shifted up. Trying to delete a record that does not exist should give an error message.

When you delete records, you do not need to worry about shrinking the file. You can instead have a special end-of-file character, for example @ etc, and fill with blanks the place occupied by the last record.

When you insert a new record, it should be appended to the end of the file (to the first location after the last actual record)

You can assume that Student_no is a key for the relation.



The file should be a text file that is readable by humans! The contents of the file will be checked before your program runs, and also after it is finished.

What you will need to do this lab:


Refreshing your memory about the C or C++ file manipulation functions. Reading about fixed-length records in your textbook (Chapter 11).

Grading


30% for work done, 70% for answering questions.


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azrefs.org 2016
rəhbərliyinə müraciət

    Ana səhifə