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

Function main

Examples/NoModules/Chapter 20/Ex20_13B/Ex20_13B.cpp:12–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10void printVector(const std::vector<int>& v); // Print the contents of a vector to std::cout
11
12int main()
13{
14 const size_t num_numbers{ 20 };
15
16 const auto numbers{ fillSet_1toN(num_numbers) };
17
18 std::vector<int> odd_numbers;
19 std::ranges::copy_if(numbers, back_inserter(odd_numbers),
20 [](int n) { return n % 2 == 1; });
21
22 printVector(odd_numbers);
23}
24
25std::set<int> fillSet_1toN(size_t N) // Fill a set with 1, 2, ..., N
26{

Callers

nothing calls this directly

Calls 2

fillSet_1toNFunction · 0.70
printVectorFunction · 0.70

Tested by

no test coverage detected