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

Function main

Examples/NoModules/Chapter 10/Ex10_01.cpp:8–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6template<typename T> T larger(T a, T b); // Function template prototype
7
8int main()
9{
10 std::cout << "Larger of 1.5 and 2.5 is " << larger(1.5, 2.5) << std::endl;
11 std::cout << "Larger of 3.5 and 4.5 is " << larger(3.5, 4.5) << std::endl;
12
13 int big_int {17011983}, small_int {10};
14 std::cout << std::format("Larger of {} and {} is {}\n",
15 big_int, small_int, larger(big_int, small_int));
16
17 std::string a_string {"A"}, z_string {"Z"};
18 std::cout << std::format(R"(Larger of "{}" and "{}" is "{}")",
19 a_string, z_string, larger(a_string, z_string)) << std::endl;
20}
21
22// Template for functions to return the larger of two values
23template <typename T>

Callers

nothing calls this directly

Calls 1

largerFunction · 0.70

Tested by

no test coverage detected