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

Function computeValues

Examples/NoModules/Chapter 16/Ex16_07A/Ex16_07A.cpp:23–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23double* computeValues(size_t howMany)
24{
25 double* values{ new double[howMany] };
26 try
27 {
28 for (size_t i {}; i < howMany; ++i)
29 values[i] = computeValue(i);
30 return values;
31 }
32 catch (const Trouble&)
33 {
34 std::cout << "I sense trouble... Freeing memory..." << std::endl;
35 delete[] values;
36 throw;
37 }
38}
39
40double computeValue(size_t x)
41{

Callers 1

mainFunction · 0.70

Calls 1

computeValueFunction · 0.70

Tested by

no test coverage detected