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

Function main

Exercises/NoModules/Chapter 10/Soln10_02.cpp:24–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22const char* larger(const char* a, const char* b);
23
24int main()
25{
26 std::cout << "Larger of 1.5 and 2.5 is " << larger(1.5, 2.5) << std::endl;
27 std::cout << "Larger of 3.5 and 4.5 is " << larger(3.5, 4.5) << std::endl;
28
29 const int big_int {17011983}, small_int {10};
30 std::cout << "Larger of " << big_int << " and " << small_int << " is "
31 << larger(big_int, small_int) << std::endl;
32
33 const auto a_string {"A"}, z_string {"Z"}; // now string literals (type const char[])!
34 std::cout << "Larger of \"" << a_string << "\" and \"" << z_string << "\" is "
35 << '"' << larger(a_string, z_string) << '"' << std::endl;
36}
37
38// Template for functions to return the larger of two values
39template <typename T>

Callers

nothing calls this directly

Calls 1

largerFunction · 0.70

Tested by

no test coverage detected