// Oldham, Jeffrey D. // 1999 Sep 09 // CS1320 // Typed by John Word for CS1320-4. // This program sums and averages the integers in a file or typed by // the user. #include int main() { int x = 1; double sum = 0.0; int count = 0; while(cin >> x) { sum += x; count = count + 1; } cout << "The sum is " << sum << ".\n"; if(count != 0) cout << "The average is " << sum/count << ".\n"; else cout << "There average is undefined.\n"; return 0; }