Programming advice with loops

I am supposed to do.
1. Use sentinel, nested and EOF loops to do file I/O.
2. Create a program file to read a data file and find the section number(first four digits) in a sequence of data(each line).
3. Then find the maximum, minimum and average of each section.
4. Then store these results in an output file.
5. create an outer loop that uses an end of file loop to find the average of each section. an store it in the same file.

There are no compiling errors but when I go to open the program file nothing happens am I doing something wrong?

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using namespace std;

int main()
{
string Section;
ifstream infile; // input file
ofstream outfile; // output file
int count; // number of vlaues on the line
float sum; // sum of numbers on line
int number; // number on line
float average; // Average of line
int currvalue;	//Current data value
int minvalue;	//Minimum data value
int maxvalue;	//Max data value
float sumo;	//Sum of averages
float averageo;	//average of averages
float numbero;	//single average to total
int counto;	//number of averages
string section; // Section number
bool positive;

infile.open("scores.txt");

if (!infile)	//Test the file
{
{cout<<"Cannot open inputfile.";	//Failure 
system ("pause");
return 1;
}

outfile.open("out.txt");

if (!outfile)	//Test the file
{
cout<<"Cannot open outputfile.";	//Failure 
system ("pause");
return 1;
}	

cin>>section;	//Accuire section
cout<<section;	//Display section

while (currvalue > 0)
{
counto = 0;
sumo = 0;
while(infile)
{
cin>>currvalue;
if (currvalue > maxvalue)
maxvalue = currvalue;
else if (currvalue < minvalue)
minvalue = currvalue;
else 
currvalue = 0;
return 0; 
} 
while (number > 0)

{
count = 0;	//Quantity of values
sum = 0;	//Total of values
positive = true;	//Loop control flag
while (positive)	//Stop for end value
{
cin>>number;
if (number < 0)
positive = false;
else sum = sum + number;
count++;	//increase count
}
average = sum / count;
cout<<maxvalue<<minvalue<<average<<setprecision(2)<<endl;
return 0;
}
sumo = sumo + numbero;
counto++;
averageo = sumo / counto;
cout << "Average for all sections " << averageo << endl;
}
}
}

--------------------------------------
and the data (scores.dat)

0372 36 67 87 85 65 77 89 -1
0481 89 92 67 -1
0754 76 91 83 45 -1
0892 44 79 97 58 -1
0938 91 67 87 86 95 80 -1
Topic archived. No new replies allowed.