-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool Function(int k, int L)
{
return (k < L);
}
struct ObjectClass {
bool operator() (int k, int L)
{
return (k < L);
}
} StructObject;
int main ()
{
int arr[] = {112, 125, 101};
vector<int> Number(arr, arr + 3);
sort (Number.begin(), Number.begin() + 2);
sort (Number.begin() + 1, Number.end(), Function);
sort (Number.begin(), Number.end(), StructObject);
for (vector<int> :: iterator Iter = Number.begin(); Iter != Number.end(); ++Iter)
cout << ' ' << *Iter;
return 0;
}
-
- 101 112 125
- 101 112
- 101
- Compilation Error
- None of these
Correct Option: A
In this style algorithm, We have sorted the elements in the vector by using the sort method.