Question: Write a simple telephone directory program in C++ that looks up aphone numbers in a file containing a list of names and phone numbers. The
Write a simple telephone directory program in C++ that looks up aphone numbers in a file containing a list of names and phone numbers. The user should be prompted to enter a first and last name, and the progam should then either output the corresponding number or indicate that the name isn't present in the directory. After each lookup the program should ask the user whether he or she wants to look up another numbers and then eithher repeat the process or exit the program. The data on the file should be organized so that each line contains a first name, a last name, and a telephone number separated by blanks. You can return to the beginning of the file by closing it and opening it again.
Type/paste the following into an input file named infile.txt. Add 1 name and number of your choice.
Harry Keeling (202)806-4830 Frank James (301)123-3459 Arthur Paul (202)865-9090 Todd Shurn (410)560-8909
Requirements
The program should use functional decomposition to solve this problem and code the solution using a void function named lookup_name with three reference parameters( myfile, fullname, phone_number). Also, your program must use a for loop to lookup the telephone number. Prompting the user for first name and last name can be done in either functions, however the main should output the results from the look_up function.
A MATCH is denoted by the phone_number variable not being an empty string (phone_number != ""). Use the following prototype:
void lookup_name(ifstream&, string&, string&); // prototype
Here is what your output should look like::
Program Output
Paste your source code and output (as a comment) into the space below
must be done in c++ thank you
CV- ndo Enter first name Harry Enter last name Keeling The Telephone number you requested is C202 806-4830 Do you want to look up another name in the directory KYN Enter first name Arthur Enter last name Paul The Telephone number you requested is (202 865-9090 Do you want to look up another name in the directory KYN Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
