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

Dave Sinkula commented: Use code tags. +0

>am i on the right track at all?
Does it work? If so then you're on the right track, otherwise you're doing something wrong.

commented: :p +1
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.