Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
     #include <iostream>
    #include <vector>
    #include <algorithm>
    using namespace std;
    void show(const vector<int>& Data)
    {
    for (size_t k = 0; k < Data.size(); ++k)
    {
    cout << Data[i] << ' ';
    }
    cout << endl;
    }
    int main()
    {
    vector<int> Data;
    Data.push_back(2);
    Data.push_back(6);
    Data.push_back(6);
    sort(Data.begin(), Data.end());
    show(Data);
    while(next_permutation(Data.begin(), Data.end()))
    show(Data);
    return 0;
    }
    1. 2 6 6
    2. 6 2 6
    3. 6 6 2
    4. All of above
    5. None of these
Correct Option: D

In this program, We are finding the permutation for the given value.



Your comments will be displayed only after manual approval.