Engineer bro!
Fri Nov 12 2021 (2 years ago)
Engineer by mistake!
I am a software engineer by passion
In this article, we'll see that how can we use the for_each
function of C++.
for_each
function is used to do some operations for every element in the range .
int main() {
vector<int> v{41, 61, 81};
auto print = [](int n) {
cout << " " << n;
};
for_each(v.begin(), v.end(), print);
return 0;
}
© 2021 dsabyte. All rights reserved