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

Function largest

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

Finds the largest of an array of double values

Source from the content-addressed store, hash-verified

27
28// Finds the largest of an array of double values
29double largest(const double data[], size_t count)
30{
31 double max{ data[0] };
32 for (size_t i{ 1 }; i < count; ++i)
33 if (max < data[i]) max = data[i];
34 return max;
35}
36
37// Finds the largest of a vector of double values
38double largest(const std::vector<double>& data)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected