Ask C/C++ Expert


Home >> C/C++

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

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92655277

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As