A Second Programming Assignment

For this assignment, you are to write a program to be a simple phone book. Your program should operate in two phases. The first phase will be entering the data into the book. Your program should ask the user how many entries there are to be in the book and then ask for that many names and numbers. Once that phase is complete, your program should begin asking for names. After each name is entered, your program should search its phone book and print out the number for that person if they are in the book.

There are several questions you need to answer for yourself as you begin to address this program. First, will you be dealing with the person's whole name or just their first name? Second, how will you represent the numbers. If you use integers, remember that you won't be able to use the hyphen or parentheses often used in expressing phone numbers. If you use strings to hold the numbers, then this restriction and the one on the length of the number can be removed.

Several of the functions and code fragments in this tutorial will be useful here as will the program listed at the end of the Lab 5 handout in your course packet. (That program does something quite similar, but watch out for the differences.)


You can return to the index or move on to the next lesson .