Answers for "c++ set element at index"

C++
0

c++ set element at index

std::set<int> my_set;
//inserting element in set
my_set.insert(5);
my_set.insert(15);
my_set.insert(10);
my_set.insert(7);

//accessing nth element form set
int x = *std::next(my_set.begin(), n);
Posted by: Guest on May-17-2021

Browse Popular Code Answers by Language