Homework5

advertisement
CSC 125 Introduction to C++ Programming
Fall 2005
Homework 5
Due Date: December 7, 2005 at 2:00pm in class
Problem: Phone Number List Application
Write a program that has an array of at least 10 string objects that hold people’s names
and phone numbers. You may use two parallel arrays, of which one holds people’s
names, and another holds the corresponding phone numbers. Or you may make up your
own strings, such as “Becky Warren. 417-619-1234”, thus use one array to hold names
and phone numbers together. The program should ask the user to enter at least 10
people’s names and phone numbers stored in arrays. Please check the input validation for
phone numbers’ typing. Your program requires that user’s typing for phone numbers
meets the following criteria:
 The phone number should be 12 characters longs
 All the characters except for - should be digits.
 The fourth and eighth characters should be -.
Then, the program should ask the user to enter a name or partial name to search for in the
array. Any entries in the array that match the string entered should be displayed. For
example, if the user enters “Palmer” the program should display the following names
from the list:
Gerl Palmer, 417-234-0987
Ron Palmer, 404-234-9087
Requirement:
Please design a friendly interface to the user.
Your program should allow the user to enter people’s name and phone numbers once, and
then to repeat searching for phone numbers.
Please use some examples to test your program.
Submission:
1. Print out of the program.
2. Sample runs (screen print outs)
3. A floppy disk (or CD or email to huiliu@missouristate.edu) holding two files:
asg5.cpp and asg5.exe.
It is better to upload your program to \\eccentric\Upload\CSC125\001.
If you determine to email your homework to me, please notice:
I wanna to receive a compressed file named as asg5.zip, which includes asg5.cpp and
asg5.exe.
The subject of the email is shown as “C++ homework5, from your full name”.
Note:
1. For all assignments, always use comments to explain your program.
2. Assignments need to be returned at the beginning of the lecture on the due date.
3. A late assignment will receive reduce credit of 10% for each 24-hour period
(including weekends and holidays) after the due dates. A late assignment will not be
accepted after that assignment has been graded and returned to the students unless
prior arrangements have been made with the instructor.
4. Assignments will generally be graded within one week. You will be notified
otherwise.
5. Programming assignments will be compiled and executed using Virtual C++ on the
machines in the departmental computer labs under the Window environment. Any
programming assignment that fails to do so will not be accepted.
Download