Project Description:
Create a program that allows a user to manage their primary contacts.
Sample Run:
Contact Management System
COMMAND MENU
list - Display all contacts
view - View a contact
add - Add a contact
del - Delete a contact
exit - Exit program
Command: list
1. Betty Johnson, 3333
2. Mark Arlington, 4444
Command: view
Number (1 - 2): 3
Invalid number. Please try again!
Command: view
Number (1 - 2): 2
Mark Arlington, 4444
Command: add
Name: Andy Patel
Email: andy.patel@hotmail.com
Phone: (415) 222-3333
ID: 5555
Andy Patel, 5555 was added.
Command: del
Number (1 - 3): 0
Invalid number. Please try again!
Command: del
Number (1 - 3): 1
Betty Johnson, 3333 was deleted.
Command: list
1. Mark Arlington, 4444
2. Andy Patel, 5555
Command: exit
Thank you for using my app.
Specifications:
Use the provided tab-delimited text file named contacts.txt to store the starting data for the program.
Define a structure to store the data for each contact.
When the program starts, it should read the contacts from the tab-delimited text file and store them in a vector of contact objects.
When reading data from the text file, you can read all text up to the next tab by adding a tab character (' ') as the third argument of the getline() function.
When adding or deleting a contact, the changes should be saved to the text file immediately. This ensures that no changes are lost, even if the program crashes later.
Your program should have the following functions:
- display(): Shows all items in the list of contacts.
- add(): Adds a new contact to the list of contacts.
- view(): Displays a specified contact from the list of contacts.
- delete(): Removes a specified contact from the list of contacts.
- display_title(): Displays the title of the program.
- display_menu(): Shows the menu of the program for the user to enter a command.
- main(): Starts the program.
Your program should display the current number of contacts in the list so that the user knows how to enter valid data. For example, if the list has 3 contacts, your program should display "Number (1 - 3): ".
Note that the first index of the list is 0, but the first contact starts with 1. For instance, if the user enters 1, the first contact with index 0 will be displayed.