-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int num[] = {15, 25, 35, 35, 25, 15, 15, 25};
vector<int> VectorData(num, num + 8);
sort (VectorData.begin(), VectorData.end());
vector<int> :: iterator Lower, Upper;
Lower = lower_bound (VectorData.begin(), VectorData.end(), 35);
Upper = upper_bound (VectorData.begin(), VectorData.end(), 35);
cout << (Lower - VectorData.begin()) << ' ';
cout << (Upper - VectorData.begin()) << '\n';
return 0;
}
-
- 15 25
- 25 15
- 6 8
- 8 6
- Compilation Error
Correct Option: C
In this program, We are finding the upper bound and lower bound values by using lower_bound and upper_bound methods.