Write a program to compute numeric grades for a course. The
course records are in a file that will serve as the input file. The
input file is in exactly the following format:
Each line contains a student’s last name, then one space,
followed by the student’s first name, then one space, then ten or
fewer quiz scores.
(If there are fewer than ten scores, that means the student
missed one or more quizzes.) The quiz scores are whole numbers and
are separated by one space. Your program will take its input from
this file and send its output to a second file. The data in the
output file will be the same as the data in the input file except
that there will be one additional number (of type double) at the
end of each line. This number will be the average of the student’s
quiz scores. The average score is the sum of the quiz scores
divided by 10. This amounts to giving the student a 0 for any
missed quiz.
The output file will contain a line (or lines) at the
beginning of the file explaining the output. Use formatting
instructions to make the layout neat and easy to read.
After placing the desired output in an output file, your
program will close all files and then copy the contents of the
output file to the input file so that the net effect is to change
the contents of the input file.
Use at least two functions that have file streams as all of
some of their arguments.
Hint: Check out putback member function. See topic in Files
menu.
SAMPLE OUTPUT
Input file:
test_ line_ 10 20 30 40 50 60 70
Price Betty 40 50 60 70 60 50 30 60 90
Goodman John 60 70 80 90 100 90
Smith Charles 70 80 90 60 70 60 80 90 90 90
Spangenberg Ward 70 70 80 90 70 80 90 80 70 60
Output file:
Last Name, First Name, up to 10 quiz scores. last entry is the
average.
test_ line_ 10 20 30 40 50 60 70 28.00
Price Betty 40 50 60 70 60 50 30 60 90 51.00
Goodman John 60 70 80 90 100 90 49.00
Smith Charles 70 80 90 60 70 60 80 90 90 90 78.00
Spangenberg Ward 70 70 80 90 70 80 90 80 70 60 76.00
Point Distribution:
-50 Does not compile
-5 Warnings
-5 No description multiple line comments (name, date,
etc)
-5 No single line comments (logic, input, output, etc)
-20 Does not use at least 2 programmer defined functions with
stream passing.
-10 Does not copy output file to input file
-10 Does not format output
thank you