Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main ()
    {
    vector<int> VectorData;
    VectorData.push_back(45);
    VectorData.push_back(55);
    VectorData.front() += VectorData.back();
    cout << VectorData.front() << '\n';
    return 0;
    }
    1. 55
    2. 45
    3. 100
    4. Compilation Error
    5. None of these
Correct Option: C

In this program, We added all the values in the vector by using front and back operation.



Your comments will be displayed only after manual approval.