/************************************************************************* *Adam up! *programmer:Jason Calcagno *reads an unspecified number of integers and finds their sum and mean *Input: integers from a file *output: sum and arithmetic mean, appropriately labeled *date: 11/1/02 *AP/IB computer science *************************************************************************/ #include #include int main() { double sum= 0; int count = 0; int num; double mean; ifstream inFile ("Sample.txt"); inFile>>num; while (inFile) { sum+=num; inFile >> num; count++; } mean = sum / count; cout << "The sum of the "<< count << " numbers is " << sum << ".\n"; cout << "The mean of these numbers is " << mean << ".\n"; inFile.close(); return 0; } /* The sum of the 358 numbers is -7467. The mean of these numbers is -20.8575. Press any key to continue */