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

Function main

Exercises/NoModules/Chapter 16/Soln16_03/Soln16_03.cpp:7–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "RandomBoxes.h"
6
7int main()
8{
9 Truckload load;
10 const size_t boxCount {20}; // Number of Box object to be created
11
12 // Create boxCount Box objects
13 for (size_t i {}; i < boxCount; ++i)
14 load.addBox(randomSharedBox());
15
16 try
17 {
18 std::cout << "The truckload contains the following boxes: " << std::endl;
19 for (size_t i {}; i < 100; ++i)
20 {
21 std::cout << *load[i] << std::endl;
22 }
23 }
24 catch (const std::exception& caughtException)
25 {
26 std::cerr << "Oops: " << caughtException.what() << std::endl;
27 }
28}

Callers

nothing calls this directly

Calls 3

randomSharedBoxFunction · 0.70
addBoxMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected