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

Function show_data

Examples/Modules/Chapter 08/Ex8_13.cpp:31–45  ·  view source on GitHub ↗

Outputs an array of double values

Source from the content-addressed store, hash-verified

29
30// Outputs an array of double values
31void show_data(const double data[], size_t count,
32 const std::string& title, size_t width, size_t perLine)
33{
34 std::cout << title << std::endl; // Display the title
35
36 // Output the data values
37 for (size_t i {}; i < count; ++i)
38 {
39 // Display a data item (uses a dynamic field width: see Chapter 7)
40 std::cout << std::format("{:{}.6g}", data[i], width);
41 if ((i + 1) % perLine == 0) // Newline after perLine values
42 std::cout << '\n';
43 }
44 std::cout << std::endl;
45}
46
47const double* smallest(const double data[], size_t count)
48{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected