1set<int> s = {1,2,3}
2auto it = s.end();
3it--;
4cout<<*it<<"\n"; // This refers to last element of a set
1// Example program
2#include <iostream>
3#include <string>
4#include <set>
5#include <iterator>
6using namespace std;
7int main()
8{
9 set<int>a = {5,9,100,25,4,6};
10 auto it = a.end();
11 it--;
12 cout << *it;
13}