Question: C++ a program to implement a simple address book that stores phone numbers, names, and addresses and allows the user to look up an entry

C++ a program to implement a simple address book that stores phone numbers, names, and addresses and allows the user to look up an entry based on any of them. After each lookup the program should ask the user if they want to look up another until they are done. The file should be structured so that a person's first name, last name, and phone number are stored on one line separated by commas and the next line has their address. (Note: The program does not need to create the file, just read an already existing file.) I'm having trouble reading the file and outputing the correct results.

heres one of my functions:

string getName(ifstream inData) { string firstName; string lastName; string address; string number; string filename;

inData.open(filename.c_str());

while (inData) { inData >> firstName >> lastName >> number;

inData>>address>>endl;

} while (!inData) // If name is not in the directory { cout << "Name is not in directory. Please try again." << endl; }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!