Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
#include
using namespace std; void add_one(int &value) { value++; } int main() { vector
numbers = {1, 7, 3, 5, 9, 2}; // Increase each number by one for_each(numbers.begin(), numbers.end(), add_one); // Output the modified numbers for (int number : numbers) { cout << number << " "; } return 0; }
2 8 4 6 10 3