Question
C++ Program: For this assignment you will create a program to manage phone contacts. Your program will allow the user to add new phone contacts,
C++ Program:
For this assignment you will create a 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 (if any) from a file named database.txt into a contacts array of size 50. You may NOT use vectors for this assignment.
const int MAX_CONTACTS = 50;
Contact contacts[MAX_CONTACTS];
Once the contacts are read from the database.txt file and loaded into the contacts array, the contacts array should be sorted by last name using either bubble sort or insertion sort. While the program is running, the user can choose any of the 5 available options. During the program execution, if the user chooses to add or delete contacts, the contacts array should be updated and re-sorted. Any searching of the contacts array should be performed using binary search. 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 writes the contents of the Array into the database.txt file, and then exits.
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