Question
Write a C++ program to read records in a plain text file, then remove duplicated records, and write unique ones to a plain text file.
Write a C++ program to read records in a plain text file, then remove duplicated records, and write unique ones to a plain text file. You can use any algorithm and data structures that you prefer, as long as the results are correct. It is preferred, but not necessary, that your algorithm is as efficient as possible, both in processing time as well as memory management.
Input and Output Specification:
The input is one text file with 0 - 10000 records. The content of each record is confined to a pair of {} and doesnt contain { or }, but may have other symbols like space, comma, colon, single or double quote, and so on. In the input and output file, each line ends in a character. One record may not be necessary in one line in the input file. But you should output each unique record in one line without any spaces. The output records can be in any orders. It doesnt matter if you have or dont have one empty line at the end of the output file.
Example of input files (between the lines)
inputl.txt id: 1234567,first:Mary, last:Green) [id: 1234568, first:Peter, last :Morgan) id: 1234567, first : Mary, last:Green) input2.txt (id: 1234567, first:Mary, last:Green, GPA: 4.0 id: 1234568, first:Peter, last:White GPA:3.8) id: 1234567, first : Mary, last:Green, GPA:3.91 output1.txt id: 1234567,first:Mary, last:Green) fid: 1234568, first:Peter, last : Morgan) output2.txtStep 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