Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <algorithm>
    #include <vector>
    using namespace std;
    int main ()
    {
    int Array[] = {45, 85, 65, 75, 85, 45, 85, 45, 85, 45};
    int countData = count (Array, Array + 10, 45);
    cout << countData << " ";
    vector<int> num (Array, Array + 10);
    countData = count (num.begin(), num.end(), 85);
    cout << countData;
    return 0;
    }
    1. 1 1
    2. 2 2
    3. 3 3
    4. 4 4
    5. 5 5
Correct Option: D

In this program, We are counting the number of 45’s and 85’s in the program.



Your comments will be displayed only after manual approval.