Finding the sum, average, large, and small number in a eof?

The file needs to find the sum, average, smallest, and largest number within the text file. Any help is greatly appreciated. Thank you.

#include<iostream>
#include<fstream>
#include <string>

using namespace std;

int main()
{

int count, number[10],small,large,maxRows,row;
double avg,sum;
string count="y";
int i=0;

ifstream input;

input.open("C:\\Users\\Chelsey\\Deskt…

count = 0;


while( !input.eof())
{
input>>number;
cout<<number<<endl;

while (count =="y")
{
cout<< "Enter an integer";
cin>>number[i];
cout<<"Anymore data?";
cin>>count;

i++;
}

maxRows=i-1;

sum=0;

for (row=0;row<=maxRows)
{
row++;
sum=sum+number [row];
}
avg=sum/(maxRows+1);
small=number[0];
large=number[0];
for (row=1;row<=maxRows;row++)
{
if (number [row]>large)
large=number[row];
}
if (number[row]<small)
{
small=number[row];
}

system("pause");

return 0;

}
Topic archived. No new replies allowed.