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

Function main

Exercises/NoModules/Chapter 12/Soln12_07/Soln12_07.cpp:12–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10SharedBox findSmallestBox(const Truckload& truckload);
11
12int main()
13{
14 Truckload load; // Create an empty list
15
16 // Add 12 random Box objects to the list
17 const size_t boxCount{ 12 };
18 for (size_t i{}; i < boxCount; ++i)
19 load.addBox(randomSharedBox());
20
21 std::cout << "The random truckload:\n";
22 load.listBoxes();
23 std::cout << std::endl;
24
25 std::cout << "The same random truckload in reverse:\n";
26 load.listBoxesReversed();
27 std::cout << std::endl;
28
29 std::cout << "The largest box (found using forward iteration) is ";
30 findLargestBox(load)->listBox();
31 std::cout << std::endl;
32
33 std::cout << "The smallest box (found using reverse iteration) is ";
34 findSmallestBox(load)->listBox();
35 std::cout << std::endl;
36}
37
38SharedBox findLargestBox(const Truckload& truckload)
39{

Callers

nothing calls this directly

Calls 7

randomSharedBoxFunction · 0.70
findLargestBoxFunction · 0.70
findSmallestBoxFunction · 0.70
addBoxMethod · 0.45
listBoxesMethod · 0.45
listBoxesReversedMethod · 0.45
listBoxMethod · 0.45

Tested by

no test coverage detected