MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / average10

Function average10

Examples/Modules/Chapter 08/Ex8_09B.cpp:15–21  ·  view source on GitHub ↗

Function to compute an average

Source from the content-addressed store, hash-verified

13
14// Function to compute an average
15double average10(const double (&array)[10])
16{
17 double sum {}; // Accumulate total in here
18 for (double val : array)
19 sum += val; // Sum array elements
20 return sum / std::size(array); // Return average
21}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected