ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int i,int j) { return (i<j); }
int main () 
{
    int myints[] = {9, 8, 7, 6, 5};
    vector<int> myvector (myints, myints + 5);
    partial_sort (myvector.begin(), myvector.begin() + 3, myvector.end());
    partial_sort (myvector.begin(), myvector.begin() + 2, myvector.end(), 
    myfunction);
    for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it)
        cout << ' ' << *it;
    return 0;
}

Answer & Solution
Correct Answer: Option B
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.