this is my assignment
1) Write a C++ program to calculate the average test scores for 10
students. The test scores are stored in a file named 'scores.dat'.
The average along with the test scores should be written to an
output file named 'results.txt'.
The input file 'scores.dat' contains three columns of integers, total
of 10 lines.
The output file 'results.txt' should contain four columns:
Average Test1 Test2 Test3
_________ _______ _______ _______
*this is what i have
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
int test1, test2, test3, counter;
ifstream fin;
ofstream fout;
fin.open("scores.dat");
fout.open("results.txt");
fout << "Average" << setw(4) << "Test1" << setw(4) << "Test2" << setw(4) << "Test3" << endl;
for(counter = 1; counter <= 10; counter++)
{
fin >> test1 >> test2 >> test3;
fout << ((test1 + test2 + test3)/3) << setw(4)<< test1 <<setw(4) << test2 << setw(4) << test3 << endl;
}
return 0;
}
am i on the right track at all? any help would be well appreciated