Home » C++ Programming » Functions » Question
  1. What is the output of this program?
    #include <iostream>
    #include <functional>
    #include <algorithm>
    using namespace std;
    int main ()
    {
    int FirstData[] = {23, 33, 43, 52, 56};
    int SecondData[] = {2, 3, 4};
    int Res[6];
    transform ( FirstData, FirstData + 6, SecondData, Res, divides<int>());
    for (int k = 0; k < 5; k++)
    {
    cout << Res[k] << " ";
    }
    return 0;
    }
    1. 11 11 10 2 1
    2. 11 10 2 1
    3. 10 2 1
    4. 2 1
    5. 1
Correct Option: A

In this program, We are dividing the first with the second by using function objects.



Your comments will be displayed only after manual approval.