Ok guys, our C++ class is winding down and for our last assignments we are getting some tough problems.

We are asked to write a telephone directory program that looks up phone numbers from a separate file that contains a list of names & numbers.

The program should prompt the user to enter a first and last name, and then outputs the corresponding #. or indicates the name isn't in the directory. After each lookup, the user should be asked to look up another number or exit.

The file should obviously have data that has 3 columns with all three separated to make things easier: ie

(numbers.dat) -> James Higgins 585-1927
Martin Walters 839-1923
We are wanting to use functional decomposition for this...ie function calls....void Printname(); etc....

Easiest way to do this would be to ask for user input, and compare the name of the input to each name on the list. By using a loop you could run through all the names down the list and compare. If loop is true.. etc output number. If false try again?

Thats all i can think of...
Any help is appreciated!

Don't get overwhelmed by the complexity of the problem, but break it down into smaller units that you can deal with. For example, first write a program that just has a menu inside a loop. The menu should ask to either quit the program or find another name. Get that working then do the next step, which is to either exit the program or prompt the user for the first and last name. It would be easier to use two different variables for that to simplify reading the data file. You will also want to convert the two strings to all upper (or lower) case so that you don't have to deal with case-sensitive names.

std::string firstName;
std::string lastName;
cout << "enter first and last name\n";
cin >> firstName >> lastName;

Get all that compiled without errors and working before moving on to the next steps which are to open the file, read ot one line at a time, convert the first and last names to either upper or lower case, compare the first and last names with use input and finally either display an error message or the phone number.

ok, thankyou for the advice. How would I go about converting the names (first and last) to all upper case?

and ive never learned how to use menus or create them. what would be the best way to implement this?

>>How would I go about converting the names (first and last) to all upper case?

C++ has two different ways -- you can use the transform() method, or else you can create a loop and call toupper() for each character in the string.

string hello = "Hello World";
transform(hello.begin(), hello.end(), hello.begin(), toupper);

// or do it in a loop -- I'll leave that one up to you.

See this thread for an example of a menu.