Question: Mat and Pat want to invite their friends to a party, much as they did in Programming Exercise 8 in Chapter 16, except now they

Mat and Pat want to invite their friends to a party, much as they did in Programming Exercise 8 in Chapter 16, except now they want a program that uses files. They have asked you to write a program that does the following:
Reads a list of Mat’s friends’ names from a text file called mat.dat, which lists one friend per line.The names are stored in a container and then displayed in sorted order.
Reads a list of Pat’s friends’ names from a text file called pat.dat, which lists one friend per line.The names are stored in a container and then displayed in sorted order.
Merges the two lists, eliminating duplicates and stores the result in the file matnpat.dat, one friend per line.


Data From Chapter 16 Exercise 8

Mat and Pat want to invite their friends to a party. They ask you to write a program  that does the following:
Allows Mat to enter a list of his friends’ names. The names are stored in a  container and then displayed in sorted order.
Allows Pat to enter a list of her friends’ names. The names are stored in a second  container and then displayed in sorted order.
Creates a third container that merges the two lists, eliminates duplicates, and displays the contents of this container.

Step by Step Solution

3.58 Rating (173 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER include i ost ream include f stream include string include vector include al gorithm using na... View full answer

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 Introduction Java Program Questions!