-
What is the output of this program?
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;
int main ()
{
int num[] = {-12, -41, -15, -20, -10};
transform ( num, num + 2, num, negate<int>() );
for (int k = 0; k < 5; ++k)
cout << num[k] << " ";
}
-
- 12
- 12 41
- 12 41 -15
- 12 41 -15 -20
- 12 41 -15 -20 -10
Correct Option: E
In this program, We negated the given value by using the functional objects, So it is producing this output.