Write a C program that will do the following:
• Read in a number of records of your friends’ names and birthdays (string with format %26lt;mmdd%26gt;). Save it on a binary file. Each record (struct) must also have a record number (sequential and starting at 1) that is generated automatically by the program and stored in the first field of the struct.
• Create two index files, i.e. a file consisting of a name field and a record number field. The file must be sorted (use a sorting algorithm) according to the name field. Do the same for the birthday field. This process must take place automatically after the names have been entered.
• Use the index files to find the birthday of a friend if the name is entered, or the name if a date is entered, or a list of every birthday in a specific month.
• You must also be able to update the file (go to the end and add records).
• All the above options must be displayed as a menu and implemented by means of appropriate functions. Also give appropriate error messages (e.g. if the file does not exist.
Help with c programming?
Wow, that sounds like a really cool HOMEWORK ASSIGNMENT. I wouldn't want to take the fun away of doing it YOURSELF.
Reply:that's a huge problem.
you can use the fscanf() and fprintf() functions for file access
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment