Question
Create a C++ program to manage phone contacts. Your program will allow the user to add new phone contacts, display a list of all contacts,
Create a C++ program to manage phone contacts. Your program will allow the user to add new phone contacts, display a list of all contacts, search for a specific contact by name, delete a specific contact. Your program should provide the user with a console or command line choice menu about possible actions that they can perform.
The choices should be the following: 1. Display list of all contacts. 2. Add a new contact. 3. Search for a contact given the contacts first or last name. 4. Delete a contact. 5. Exit program.
To represent a contact in your program, create a struct named Contact with the following fields: firstName - string lastName - string phoneNumber - long phoneType enum PhoneType
The PhoneType can be only one of the following: CELL, HOME, WORK.
When the program first loads, it reads all the saved contacts from a file named database.txt into an Array. While the program is running, the user can choose any of the 5 available options. When the user selects the option 5 (exit program), the program stores the current contents of the Array to the file (replacing the old contents) and exits. During the program execution, if the user chooses to add or delete items, only the Array will be updated. The database.txt file will be updated automatically only when the program is about to exit. In other words, when the user selects option 5, the program first saves all the contents of the Array into the text file, and then exits.
The format of the contents of the database.txt file should be in human readable plain text, one record per line (note the ~ separator between different entries) For example (these are the first three lines should be on database.txt):
Shawn~Seals~5124567890~0 Ted~Sheckler~2104567890~2 Chip~Chipperson~9404567890~1
For display, contacts should be printed to the console in the following format.
Chip Chipperson, Home (940)456-7890 Shawn Seals, Cell (512)456-7890 Ted Sheckler, Work (210)456-7890
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started