Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions