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

  Questiontwo stacks of positive integers are required both

questiontwo stacks of positive integers are required both containing integers with values less than or equal to 1000.

  Find out the differences between the two files

Append the last two lines of each file to the file known Mollett.out without cutting and pasting (Hint: tail command can do this)

  A function called searcher that uses pointers

Your program will include a function called searcher that uses pointers to both the source string and the character set, and which returns a pointer to a char.

  What are some of the configuration options

The servers will have static IP addresses. What should you install on one of the servers, and what are some of the configuration options?

  What materials will you use in the study

What materials will you use in the study? Will you use an interview protocol? If so, then provide the protocol that you will use for a qualitative study

  Write a program that asks the user to enter a month

Write a program that asks the user to enter a month (1 for January, 2 for February, and so on) and then prints the number of days in the month.

  How can atomic broadcast be used to manage group membership

How can atomic broadcast be used to manage group membership? When a computation runs for a long time, it is sometimes wise to make checkpoints periodically.

  What may cause the loss of one control file

Why must a business have its database in ARCHIVELOG mode?

  What are your conclusions

If, on the average, one record in every 200 records is garbled, how long will it take to transmit 1000 records? What are your conclusions?

  Why is cout able to display various cpp types

Why is cout able to display various C++ types without being provided explicit instructions for each type?

  Identify the specifications you would need to gather

Assignment: Power Supply Replacement Process- Identify the specifications you would need to gather to select an appropriate power supply for a system.

  Differences between the java programming languages

What are the main differences between the Java programming language and the language discussed

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