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

Function yield

Examples/NoModules/Chapter 08/Ex8_06.cpp:18–29  ·  view source on GitHub ↗

Function to compute total yield

Source from the content-addressed store, hash-verified

16
17// Function to compute total yield
18double yield(const double array[][4], size_t size)
19{
20 double sum {};
21 for (size_t i {}; i < size; ++i) // Loop through rows
22 {
23 for (size_t j {}; j < std::size(array[i]); ++j) // Loop through elements in a row
24 {
25 sum += array[i][j];
26 }
27 }
28 return sum;
29}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected