", al, 15); cout « "centeredAverage: " < centeredaverage(al,="" 15)="" «="" endl;="" cout="" «="" endl;="" 7="" 8="" 10="" 11="" 12="" double="" a2[]="{15.0};" print="" ("a2-="">", a2, 1); cout « "centeredAverage: cout « endl; 13 14 15 « centeredAverage(a2, 1) <« endl;="" 16="" 17="" 18="" double="" a3[]="{7.1,11.1,5.9,17.1};" print("a3-="">", aз, 4); cout « "centeredAverage: " « centeredAverage(a3, 4) « endl; cout « endl; 19 20 21 22 double a4[] = {12.7}; print ("a4->", a4, 1); cout « "centeredAverage: cout « endl; 23 24 25 « centeredAverage (a4, 1) <« endl;="" 26="" 27="" "/="">
Extracted text: Return the centered average of an array, which is the mean average of the values, ignoring the largest and smallest. If there are multiple copies of the smallest or largest values, ignore just one. If the array length is less than 3, then return 0. You may use a loop, or the algorithms in the standard library. arrays.cpp 1 #include
2 #include using namespace std; 4 double centeredAverage(const double a[], size_t len) { 8 10 } Demo.cpp 1 #include 2 using namespace std; 3 4 #include "arrays.h" 6. int main() { double al[] = {13.4,6.2,3.2,10.8,13.5,10.7,14.4,14.4,4.0,4.0,13.9,13.6,12.7,6.3,4.7}; print("al->", al, 15); cout « "centeredAverage: " < centeredaverage(al,="" 15)="" «="" endl;="" cout="" «="" endl;="" 7="" 8="" 10="" 11="" 12="" double="" a2[]="{15.0};" print="" ("a2-="">", a2, 1); cout « "centeredAverage: cout « endl; 13 14 15 « centeredAverage(a2, 1) <« endl;="" 16="" 17="" 18="" double="" a3[]="{7.1,11.1,5.9,17.1};" print("a3-="">", aз, 4); cout « "centeredAverage: " « centeredAverage(a3, 4) « endl; cout « endl; 19 20 21 22 double a4[] = {12.7}; print ("a4->", a4, 1); cout « "centeredAverage: cout « endl; 23 24 25 « centeredAverage (a4, 1) <« endl; 26 27 endl;="" 26="">« endl; 26 27>«>«>«>