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

Function average10

Examples/NoModules/Chapter 08/Ex8_05A.cpp:16–22  ·  view source on GitHub ↗

Function to compute an average

Source from the content-addressed store, hash-verified

14
15// Function to compute an average
16double average10(double array[10]) /* The [10] does not mean what you might expect! */
17{
18 double sum{}; // Accumulate total in here
19 for (size_t i{} ; i < 10; ++i)
20 sum += array[i]; // Sum array elements
21 return sum / 10; // Return average
22}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected