Question: In C++, write a program that reads names from a text file that are listed in a first name last name format and sort them

In C++, write a program that reads names from a text file that are listed in a first name last name format and sort them ascending by last name and then first name. Also calculate the number of years between the two dates next to their name. All functions must be written by scratch.

For example, input file will be name, start date, end date

Jones Larry 01 01 2005 06 01 2009 Turner Ted 05 05 2000 05 05 2021 Mark Spitz 08 23 2000 02 23 2021 Kelly Roman 08 22 2000 00 00 0000 Uless Shep 08 21 2000 02 23 2021 Tinny Moe 08 20 2000 00 00 0000 Jeffery Xi 08 24 2000 02 23 2021 Larry Sams 08 25 2000 02 24 2021 Lex Lugar 08 26 2000 02 23 2021 

The output file should be

The name in ascending order by last name with the number of years worked.

Keep count of the number of errors in the file; if the end date is smaller than the begin date

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!