/* testarr05.cpp CIS 150 06/23/2005 David Klick Demonstrations of: initializing an array displaying an array summing an array getting an average value for an array finding an array's minimum value finding an array's maximum value */ #include #include #include using std::cout; const int ARRAY_SIZE = 10; int main(void) { int nums[ARRAY_SIZE]; int ctr; int sum, min, max; double average; // seed the random number generator srand(time(NULL)); // initialize the array to random numbers for (ctr=0; ctr max) max = nums[ctr]; } cout << "The largest value is " << max << '\n'; return 0; } /* Sample output: The array contains: 81 20 85 96 80 93 84 69 1 40 The sum is 649 The average is 64.9 The smallest value is 1 The largest value is 96 */