Question PRG-CPP-0018
HardWhat is the output of this program?
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> v = {1, 2, 3};
transform(v.begin(), v.end(), v.begin(), [](int x) { return x * 2; });
for (int x : v) cout << x << " ";
return 0;
}
- A.
2 4 6
- B.
1 2 3
- C.
Sign up free to see the answer and a step-by-step explanation.