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

Function main

Examples/Modules/Chapter 13/Ex13_03A/Ex13_03A.cpp:19–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19int main()
20{
21 const std::vector boxes {Box {2.0, 1.5, 3.0}, Box {1.0, 3.0, 5.0},
22 Box {1.0, 2.0, 1.0}, Box {2.0, 3.0, 2.0}};
23 const Box theBox {3.0, 1.0, 4.0};
24
25 for (const auto& box : boxes)
26 if (theBox > box) show(theBox, " is greater than ", box); // > works
27
28 std::cout << std::endl;
29
30 for (const auto& box : boxes)
31 if (theBox != box) show(theBox, " is not equal to ", box); // != works
32
33 std::cout << std::endl;
34
35 for (const auto& box : boxes)
36 if (6.0 <= box) // Yes, even double <= Box works!!
37 { std::cout << "6 is less than or equal to "; show(box); std::cout << std::endl; }
38}

Callers

nothing calls this directly

Calls 1

showFunction · 0.70

Tested by

no test coverage detected