Question
c++ program You are to write a program that will read in names and phone numbers, rearrange each persons name, and create a sorted phone
c++ program
You are to write a program that will read in names and phone numbers, rearrange each persons name, and create a sorted phone directory in a link list format. The list has been collected form different places, placed in a file where the names are not in some standard format. A persons last name may appear last or it may appear first on the input. A label has been associated with each name to identify where the last name appears. Either surname or lastname appears just before a persons last name. The other will be his first name followed by optionally middle initial or name. Capitalize the first letters in each part of the name. Below are examples of inputs. Input file: NamesAndPhoneV2.txt
Read in the names, and arrange them with the first name first, followed by his middle name or initial if it exist followed by the last name. You must use a link list for you data structure and the list must be a sorted list, sorted on the last name. You must insert a new name into the link list and maintain a sorted order link list. Print out the resulting names and phone directory.
Hint: Read input as strings even the phone number. Look for for the end of line character if reading one char at a time, or optionally if the last string you read had a digit in it (ie looking for a digit might be the better way).
Example input
tom archer lastname jones 555-1234
lastname dewy luewey 288-1324
See More surname Or-less 332-6133
Example output (Sorted):
Luewey Dewy 288-1324
Tom Archer Jones 555-1234
See More Or-less 332-6133
NamesAndPhoneV2.txt
lastname Taylor marie denise 939-1512 james wilis surname thomas 261-8342 Stone Rock lastname Brown 544-2372 surname lea lee high 266-8324 stephens lastname reynolds 696-9231 lastname jam Dirdy toe 555-2391 lastname Russell mack 123-1234 surname Lewis Michelle Tee 828-2148 john mark surname marshall 888-2891 lastname Moto hasey 823-8000 o e lastname vey 177-1423 or Twosee surname knocktosee 823-8321 two B surname orknot 394-8425 Mack lastname Camp 284-9843 kound Cant lastname never 940-8324 surname two N finitee 724-8234 lastname ghigher Eve N 398-1453 Ttow surname jammer 924-5231 Uh lastname nuther 432-4345 surname Lotts lue Knew 743-4594 Ah C lastname moto 849-3324 surname much too 883-2923 lastname done Jjust abot 463-9002 Al Dah surname zame 632-7432 lastname auf Tu Phinish 382-8324
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started