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

Function main

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

int largest(const std::vector & words); Above function overload would not compile: overloaded functions must differ in more than just their return type! */

Source from the content-addressed store, hash-verified

12 /* Above function overload would not compile: overloaded functions
13 must differ in more than just their return type! */
14int main()
15{
16 double array[] {1.5, 44.6, 13.7, 21.2, 6.7};
17 std::vector<int> numbers {15, 44, 13, 21, 6, 8, 5, 2};
18 std::vector<double> data{3.5, 5, 6, -1.2, 8.7, 6.4};
19 std::vector<std::string> names {"Charles Dickens", "Emily Bronte",
20 "Jane Austen", "Henry James", "Arthur Miller"};
21 std::cout << "The largest of array is " << largest(array, std::size(array))
22 << std::endl;
23 std::cout << "The largest of numbers is " << largest(numbers) << std::endl;
24 std::cout << "The largest of data is " << largest(data) << std::endl;
25 std::cout << "The largest of names is " << largest(names) << std::endl;
26}
27
28// Finds the largest of an array of double values
29double largest(const double data[], size_t count)

Callers

nothing calls this directly

Calls 1

largestFunction · 0.70

Tested by

no test coverage detected