Min Max and Average

Hello, I am having trouble doing the min, max, and average of a program that takes a file with ab unch of numbers and outputs them until the console window is full, pauses, and then continues until the file is done. This is what I have for a code and the numbers I am testing with.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>    
#include <fstream>					
#include <string>
using namespace std;

int main()
{
	string filename;
	cout << "Enter file name: ";
	cin >> filename;
    ifstream myFile(filename);
	if (myFile.fail())				
	{
		cout << "Error: main(): Failed to open the file: ";
		cout << filename << endl;
	}
	else
	{
		double x;
		int i = 0;
		int count = 0;
		do
		{
			myFile >> x;
			if (!myFile.eof())
			{
				cout << x << endl;
				count ++;
				if(count%20==0)
				{
					system("pause");
				}
			}
		} while (!myFile.eof());
		
	}
	myFile.close();
	cout << endl;
	system("pause");
	return 0;
}



348967
345345
345434
3454
454
453
4
45
45
4
3
45
43
45
45
56
67
78
89
89
87

I need to find the min, max, and average after each time the console pauses for that batch of numbers. So with the numbers above, there is 21 numbers, so it stops at the second 89 and then when space is hit it puts out the 87. Thanks!
Topic archived. No new replies allowed.