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

Function main

Exercises/NoModules/Chapter 05/Soln5_06.cpp:6–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <vector>
5
6int main()
7{
8 std::cout << "What is the largest number I should check? ";
9 unsigned bound {};
10 std::cin >> bound;
11
12 std::vector<unsigned> values;
13 // Add element values 1 to bound
14 for (unsigned i {1}; i <= bound; ++i)
15 values.push_back(i);
16
17 size_t count {}; // Number of output values
18 size_t perline {10}; // Number output perline
19 for (auto value : values)
20 {
21 if (value % 7 == 0 || value % 13 == 0) continue;
22 std::cout << std::format("{:5}", value);
23 if (++count % perline == 0) std::cout << "\n";
24 }
25 std::cout << std::endl;
26}

Callers

nothing calls this directly

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected