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

Function main

Examples/NoModules/Chapter 13/Ex13_03/Ex13_03.cpp:18–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

showFunction · 0.70

Tested by

no test coverage detected