write a program that will manipulate information about people for each person the pr 5155640

Write a program that will manipulate information about people. For each person, the program will store the person's name and address, which we will call a “snippet”. The user can perform four actions on the database:
List all of the snippets in the database.
Add a snippet to the database.
Exit the program and write the current list of snippets back to the file in the correct format.

Initially, the information in the database will be contained in a text file. The name of this file will be specified as the first and only command-line argument.   The first line of the file will contain an int value specifying the number of snippets in the file. The rest of the file will contain the snippets, one per line, in the following form:

<# snippets>
::::
::::

You should assume that no piece of information in a snippet contains a colon: the colons are only used as separators. Any other character is legal in a snippet.

When your program starts, it should read all of the snippets in the file into an array of structs. It should then repeatedly prompt the user for an action, and then perform the action according to the specifications described below. Here are the details of the steps your program must perform.

On startup: Read all of the snippets in the file into set of structs. You must dynamically allocate the memory for each struct. Store the pointers to the structs in an array. You can assume that your program will never have to deal with more than 100 snippets.

Action 1: The user will enter the string “list” at the prompt. To perform this action, iterate through the structs and print out each snippet, neatly formatted using standard address notation:

Ann Archer
123 Ace Ave.
Ames, AL 12345

Action 2: The user will enter “add” at the prompt. Your program should prompt the user for name, address, city, state and zip, and add a new struct to the array.

Action 3: The user will enter “exit”. Write the number of snippets followed by each current snippet back to the file.

You can assume that you will never need to store more than 100 snippets in memory when you declare the array.

Here is the struct definition you must use to store each snippet.

#define MAX_NAME_LENGTH 32
#define MAX_ADDRESS_LENGTH 64
#define MAX_CITY_LENGTH 16
#define STATE_LENGTH 3

struct snippet {
   char name [MAX_NAME_LENGTH];
   char addr [MAX_ADDRESSS_LENGTH];
   char city [MAX_CITY_LENGTH];
   char state [STATE_LENGTH];
   unsigned int zip;
}

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now