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

Function largest

Examples/Modules/Chapter 09/Ex9_03.cpp:39–45  ·  view source on GitHub ↗

Finds the largest of a span of values

Source from the content-addressed store, hash-verified

37
38// Finds the largest of a span of values
39double largest(std::span<double> data)
40{
41 double max {data[0]};
42 for (auto value : data)
43 if (max < value) max = value;
44 return max;
45}
46
47// Finds the largest of a vector of int values
48int largest(std::span<int> data)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected