CIS 15/615                                          INSTRUCTOR: RAVE HARPAZ

 

ASSIGNMENT # 2

 

Pointers, Arrays and Structures

 

In this assignment you will start a grand project ranging over four assignments. The purpose of the project is to design and build a database of phone book records implementing different topics covered in class.

 

Program guidelines:

 

·       Design a struct type called Rec that will represent a record in your phonebook. The record will contain the following information: last name, first name and phone number (i.e. 3 fields).

 

·       Use typedef to name your data type as Pb_Rec .

 

·       The whole database will be represented by an array of 20 Pb_Rec type elements and will be called Phone_Book.

 

·       Your program should perform the following operations, using at least three functions:

1 - adding records to the database interactively using appropriate messages.

2  -  sort the database by last name.

3  -  print the sorted database/phonebook.

 

·                           You should test your program with at least 5 records.

 

·       Use pointer notation only, except for the declaration of Phone_Book, which should not be global and must be sent to your functions, i.e. passing arrays to functions.

 

·       Do not forget to comment your program and follow the programming style guidelines discussed in class.

 

·       You should hand in a cover page, source code and the output of your program.

 

Good luck !