-
What is the output of this program?
#include <iostream>
#include <set>
using namespace std;
int main()
{
set<int> DataSet;
DataSet.insert(25);
DataSet.insert(20);
DataSet.insert(30);
DataSet.insert(35);
DataSet.insert(18);
set<int> :: const_iterator p;
for(p = DataSet.begin(); p != DataSet.end(); ++p)
cout << *p << ' ';
return 0;
}
-
- 18
- 18 20
- 18 20 25
- 18 20 25 30
- 18 20 25 30 35
Correct Option: E
In this program, We are using const_iterator to sort the data