Suppose a library is processing an input file containing the titles of books in order to remove duplicates. Write a program that reads all of the titles from an input file called bookTitles.inp and writes them to an output file called uniqueTitles.out. When complete, the output file should contain all unique titles found in the input file.


Create the input file using Notepad or another text editor, with one title per line. Make sure you have a number of duplicates, including some with three or more copies.

Respuesta :

Answer and Explanation:

The given program creates two objects of class Book.When two or more objects of the same class are created, each object contains its own value in the memory.The data members of each object are separate to store the values of a particular object. However the member function of the class are created only once in the memory.These member functions are shared by all objects of the class.

Object 1 contain

Book ID  = 1

Title  = Programming fundamentals

Object 2 contain

Book ID = 2

Title = data structure and logic

then apply methods which are as follow:

get()

show()

set()

get Title()

Above are the creation of objects.

The above statement shows that all objects have their own memory address to store the values of data member.However, all objects share the same copy of member functions.

Ver imagen kalsoomtahir1
Ver imagen kalsoomtahir1
ACCESS MORE