1234567891011121314151617181920212223242526
#include <iostream> #include <fstream> #include <cstdlib> using namespace std; int main() { int count = 0, sum = 0, number; ifstream inputFile( "numbers.txt" ); if ( inputFile ) { while ( inputFile >> number ) { count++; sum += number; } cout << "sum = " << sum << '\n'; cout << "count = " << count << '\n'; // When everything else works, add code for average here } else { cout << "Can't open input file. Contents of directory are:\n"; system( "dir" ); } }