The Stimsonian Institute has long been venerated as a center for intellectual debate and innovation in the fields of elevators and physics. Unfortuneatly, it was never famous for its secretarial or administrative prowress. Quite candidly, the phone directory at the Institute is a mess. Using moneys generously donated from the Steven Dodd Foundation for Database Management and Unlisted Numbers, you have been hired to clean up their phone book.
Currently, the employee database is awkwardly stored as a text file in the following format:
3414491Clayton Price
3144810081Steven Dodd
8162637891Kate Holdener
01191404895324578Santosh Poreddy
6502530000Google, Inc
Notice there is a possibility of international numbers here, too. The basic format is the number followed by the name of person or company. Assume for simplicity that a company or person name will never have a digit in it. Your job is to read in a file with 6 directory entries and store it in an array of the following struct:
struct phonebookEntry
{
char m_phoneNumber[20]; /* made longer for international numbers */
char m_name[32]; /* store the first & last name here */
};
Read in the file of 6 entries and output the result to the screen. Using the data above, the final output should look something like this:
Clayton Price 3414491
Steven Dodd 3144810081
Kate Holdener 8162637891
Santosh Poreddy 01191404895324578S
Google, Inc 6502530000
Extend Part I to prepend the string “573” to phone numbers with a string length of 7 characters. For instance, 4688081 becomes 5734688081.
Extend Part II to sort the array in alphabetical order by last name. You can assume the last word in the phonebook entry is the “last name”. For example, the last name of Dylan Lane McDonald is “McDonald” ans the last name of Steven Dodd Foundation for Bogus Foundations is “Foundations”.
![[Dilbert]](dilbert.gif)