Write a program that would read two files

Assignment Help Computer Engineering
Reference no: EM132164312

Using C++

On my computer, I've got two grade files. One contains the grades from the first mid-term (mt1.txt), and the other contains the grades from the second mid-term (mt2.txt). Each file has exactly the same format: a lot of lines each containing the name of the student (they are all quite famous, so they all have just one single short name) followed by four integer grades. Plus, the lines are all in alphabetical order. Here is a very small example of the two files (the real ones are quite long):

mt1.txt:

Bambi 25 13 30 0

Cher 11 21 17 1

Frank 31 25 26 1

Madonna 3 7 0 1

Zelda 19 28 25 1

mt2.txt:

Bambi 31 27 17 0

Cher 26 19 21 1

Frank 33 20 24 1

Madonna 0 5 0 0

Zelda 33 29 33 1

As you can see, the two files have grades for the same students in the same order. A. Write a program that would read two files just like these (but longer) and combine them into a single file containing one line for each student, in the same order, with that one line now containing all eight of the student's grades. For the example above, the new file would be:

allmt.txt:

Bambi 25 13 30 0 31 27 17 0

Cher 11 21 17 1 26 19 21 1

Frank 31 25 26 1 33 20 24 1

Madonna 3 7 0 1 0 5 0 0

Zelda 19 28 25 1 33 29 33 1

Write very clearly and leave yourself a lot of space, because for part B, you will be modifying this program. Try to make it a whole program, with the correct C++ #includes, not library.h.

Although this is not a major requirement. Most of the points are for part A. B. Sometimes students are frightened by the first mid-term and drop the class. This means that the second file might have some people missing from it. The files could be something like this:

mt1.txt:

Bambi 25 13 30 0

Cher 11 21 17 1

Frank 31 25 26 1

Madonna 3 7 0 1

Zelda 19 28 25 1

mt2.txt:

Bambi 31 27 17 0

Frank 33 20 24 1

Zelda 33 29 33 1

But at least the two files will still be in alphabetical order. Show the modifications to your program that would be required to handle dropped students properly. When a student does not appear in the second file, the new file should still show their grades from the first mid-term. So for the new example, the output would be:

allmt.txt:

Bambi 25 13 30 0 31 27 17 0

Cher 11 21 17 1

Frank 31 25 26 1 33 20 24 1

Madonna 3 7 0 1

Zelda 19 28 25 1 33 29 33 1

Reference no: EM132164312

Questions Cloud

Discuss why users create viruses : Discuss why users try to break into other users computers and information systems.
What are four different applications where digitizing : What are four different applications where digitizing (spatial data creation and/or spatial data editing) would be useful.
Design a job class with three data fields-job number : Design a Job class with three data fields-Job number, time in hours to complete the Job, and per-hour rate charged for the Job.
Write a function that given such an array : Write a function that given such an array as its parameter, calculates and prints the average of all the data items in the array
Write a program that would read two files : Write a program that would read two files just like these (but longer) and combine them into a single file containing one line.
How would you make certain that medical information released : As a current or aspiring healthcare manager, how would you make certain that medical information is released from your facility only in accordance.
Determine soil physical and mechanical properties : Soil Mechanics – M2F724590 - Determine and analyse soil physical and mechanical properties by solving a series of analytical problems
Discuss the steps involved with an audit : Discuss the steps involved with an audit. Give an example of missing a step and what that means for the validity of the audit.
Who really owns the medical record : Describe the purpose of medical records and the importance of thorough and accurate documentation of patient care. What does the expression.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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