This is the only way I could get it to work. Although it is still repeating the last number twice, but it is giving me the average.

Code:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
using namespace std;

void main()
{
	int num, fnum, lnum, sum;
	float average, total, counter;
	char inchar;
	ofstream fileout;
	ifstream filein;


	filein.open("E:\\Resource Files\\datafile2.txt");
	fileout.open("E:\\Resource Files\\answers.txt");


	total=0;
	counter=0;
	while(filein)
	{	
		filein>>num;
		fileout<<num<<" "; 
		total=total+num;
		counter++;
	}

	average = total/counter;
	fileout<<fixed<<setprecision(3)<<endl<<"The Average from the input file is: "<<average<<endl;

		
}
Code:
55 
67 
458 
23 
81 
33 
782 
375 
528 
405 
324 
950 
46 
14 
864 
551 
38 
167 
518 
630 
630 

The Average from the input file is: 359.000
Now is there anyway I can get the third step of this assignment in the same program? I am having an issue figuring out how to get the average of the first twelve without having a separate program to do it.