// // ave.cpp: implementation of getAve function // #include "ave.h" #include // [comment repeated here for convenience - generally document at interfaces] // sets ave to the average of the non-empty array nums // precondition: size > 0 void getAve(const int nums[], int size, double &ave) { assert(size > 0); int sum = 0; for(int i = 0; i < size; ++i) sum += nums[i]; ave = double(sum) / double(size); }