Write a cpp program to read records in a plain text file

Assignment Help C/C++ Programming
Reference no: EM131826916

Programming and Data Structures Asignment: Remove Duplicated Records

1 Introduction

You will 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.

2 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 doesn't 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 '\n' 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 doesn't matter if you have or don't have one empty line at the end of the output file.
Example of input files (between the lines)

input1.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.9}
output1.txt
{id:1234567,first:Mary,last:Green} {id:1234568,first:Peter,last:Morgan}
output2.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.9}

3 Program specification

The main program should be called "removeduplicated". Call syntax is as follows (from the OS prompt):

./removeduplicated input=input1.txt output=output1.txt

Notice that the file name will not necessarily be the same every time. Therefore, your program will have to take that into account.

4 Requirements

• Homework is individual. Your homework will be automatically screened for code plagiarism against code from the other students and code from external sources. If you copy/download source code from the Internet or a book it is better you acknowledge it in your comments, instead of the TAs detecting it. Code that is detected to be copied from another student (for instance, renaming variables, changing for and while loops, changing indentation, etc) will result in "Fail" in the course and being reported to UH upper administration.

• You can develop your program on any C++ compiler (MS Visual C++, Borland C++, Intel C++), BUT you must test your program in GNU C++. The TAs have no obligation to test your program on any compiler other than GNU C++.

• don't forget to comment your code, especially complicated code. You must include a short summary of your main functions in the main cpp file.

• In input files, lines might begin with spaces, there might be empty lines, lines with only spaces, and so on. Your program need to robustly deal with these cases. Your program should not crash, halt unexpectedly or produce unhandled exceptions.

• A program that can be compiled count 10 points. Your program will be tested with 9 test cases (each counts 10 points), going from easy to difficult.

• Correctness is more important than speed. You should always err on the side of caution submitting a slow program that works correctly than a fast one that fails in many cases.

Attachment:- Input-Output-Files.rar

Reference no: EM131826916

Questions Cloud

What was the consolidated balance for land : What was the consolidated balance for Land in a consolidated balance sheet prepared at the date of the acquisition combination
Which group does walmart have monopoly power over : Some people think that businesses create monopolies by destroying their competition, and there is certainly some truth to that.
Prepare schedule to show equity income : Prepare a schedule to show the equity income Tinker should recognize for 2011 related to this investment
Determining the distribution functions : Show that X and Y are dependentb. Show that X^2 and Y^2 are independent. Hint, this might be easier by using distribution functions, rather than density functio
Write a cpp program to read records in a plain text file : You will 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.
Problem on stage performance of shakespeare hamlet : Isn't it surprising that movies, with tickets that cost around $10, often use vastly more economic resources than stage plays where tickets can easily cost.
Prepare the general journal entries required to account : Prepare the general journal entries required to account for the previous information and transactions assuming the government uses the purchases method
Outcome of the second roll : A 4-sided fair die is rolled twice. What is the probability that the outcome of the first roll is greater than the outcome of the second roll?
Define a sample space for the experiment : A coin is tossed until the first head appears, and then the experiment is stopped. Define a sample space for the experiment.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd