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

Function main

Examples/NoModules/Chapter 20/Ex20_13A/Ex20_13A.cpp:11–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

fillSet_1toNFunction · 0.70
printVectorFunction · 0.70

Tested by

no test coverage detected