hello i have a project that is due in 2 days and i need help immediatly
i just need the steps i have to do to solve the following:
"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, then the student’s first name, then one space, then ten quiz scores all on one line. 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 ten quiz scores. If this is being done as a class assignment, obtain the file names from your instructor. Use at least one function that has file streams as all or some of its arguments.

Problem 3

Enhance the program you wrote for (Problem 2) in all the following ways.
a- The list of quiz scores on each line will contain ten of fewer quiz scores. (If there are fewer than ten quiz scores, which means that the student missed one or more quizzes.) The average score is still the sum of the quiz scores divided by 10. This amounts to giving the student a 0 for any missed quiz.
b- 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.
c- 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 or some of their arguments. If this is being done as a class assignment, obtain the file names from your instruction."

I DONT WANT SOLUTION,I NEED THE STEPS TO TRY TO SOLVE IT MY SELF THX

Recommended Answers

All 3 Replies

I'm glad you put in the last line in the thread.
But I, for one, would like to see some work before helping. Just to see where you are so the advice I'm giving isn't redundant.

ok i dont know how to solve it but i was thinking as such:
ok first i create the output file called as 4ex datafile and i put in it 10 students names followed by 10 grades and i save it
i will reopen another file and use the datafile as input but what is exactly the function i should use where i will read from the informations and calculate the avg
So i was thinking about using the "copy"
[ int main(int argc,char*arg=3argv)
{
if(argc!=3)
cerr<<"invalid ";
else
{ fstream infile(argv[1]),ios::in);

fstream outfile(argv[2],ios::out); ]

ok now i wanna do a while loop that says whenever we reach the end of the line lets calculate the avg
is my logic correct?if so ow should it do the while loop
thxxxx

>>int main(int argc,char*arg=3argv)

that is not valid way to declare main() because it can not have default parameter values int main(int argc,char* argv[]); >>ow should it do the while loop while( getline(infile, line) )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.