X1214: Codewit Kevin: finding contacts with fstream in C++

Follow Kevin's demonstration and create a program that reads from a file called contacts that includes contact information. Each line has a different contact, where the first word on the line is the contact's name and the second word is their email (separated by a space). Prompt the user "Who do you want to email? " and get the user's response.

Search within the contacts file for a match with the name the user provided. If a match is found, display "Their email is " followed by the email provided on the same line in the contacts file as well as an endline. If no match is found, it should instead display, `"Contact not found!\n"

Complete only the code within the { } for int main.

Your Answer:

Reset

Practice a different C++ exercise

Feedback

Your feedback will appear here when you check your answer.