Time to apply what you know about file I/O, structs, and vectors in one complete program. You'll build a contact book that reads contacts from a file, displays them, searches for a specific one, and writes a summary back to a different file.
YOUR TASK
Write a program that does all of the following:
Defines a Contact struct with fields string name, string phone, and string email.
Stores 4 hardcoded contacts in a vector<Contact> (use the values in the expected output below).
Writes all contacts to a file called contacts.txt, one per line in the format: Name | Phone | Email
Reads the file back and prints each line to the console prefixed with Contact:
Searches the vector for the contact named "Bob" and prints their phone number prefixed with Found:
Contact: Alice | 555-1001 | alice@email.com
Contact: Bob | 555-1002 | bob@email.com
Contact: Carol | 555-1003 | carol@email.com
Contact: Dave | 555-1004 | dave@email.com
Found: 555-1002
Total contacts: 4
Code Editor
Ready
Output
Console
Console initialized...
Ready for Project 4: Contact Book
> Build your solution and hit "Check My Code"
> Once it passes, the Complete button will activate!