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> Data;
    Data.assign (5,50);
    vector<int>::iterator iter;
    iter=Data.begin()+1;
    int Array[] = {1200,20,40};
    cout << int (Data.size()) << '\n';
    return 0;
    }
    1. 5
    2. 50
    3. 20
    4. 40
    5. None of these
Correct Option: A

In this program, We are finding the size of the vector elements and resizing it.



Your comments will be displayed only after manual approval.