#include #include using namespace std; int main () { ifstream infile; // input file. int count = 0; // the total number of numbes int sum = 0; // the sum of all the numbers int tmp; // read in location int low, // lowest number high; // highest number infile.open("numbers"); if (!infile) { cout << "Could not open numbers for input" << endl; } else { infile >> tmp; low = tmp; high = tmp; while (infile) { count ++; sum += tmp; // check for a new low number if (low > tmp) { low = tmp; } // check for a new high number if (high < tmp) { high = tmp; } infile >> tmp; } infile.close(); // output statistics cout << "There were " << count << " numbers" << endl; cout << "The sum of these numbers is " << sum << endl; cout << "The largest number is " << high << endl; cout << "The lowest number is " << low << endl; cout << "The Average of the nubers is " << sum/count << endl; } }