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

Function main

Exercises/Modules/Chapter 09/Soln9_06.cpp:8–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6double average10(std::span<const double, 10> data); // Function prototype
7
8int main()
9{
10 std::vector values { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };
11 // double values[]{ 1.0, 2.0, 3.0 }; // Only three values!!!
12 std::cout << "Average = "
13 << average10(std::span<const double, 10>{ values.data(), values.size() }) << std::endl;
14}
15
16// Function to compute an average
17double average10(std::span<const double, 10> data)

Callers

nothing calls this directly

Calls 2

average10Function · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected