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

Function main

Exercises/Modules/Chapter 12/Soln12_07/Soln12_07.cpp:13–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected