Answers for "set <> c++"

C++
0

set in cpp

#include<iostream>
#include<set>
 
using namespace std;
 
int main(){
 
    // Set with values
    set<int, greater<int>> s1 = {6, 10, 5, 1};
     
    // Iterator for the set
    set<int> :: iterator it;
 
    // Print the elements of the set
    for(it=s1.begin(); it != s1.end();it++)
        cout<<*it<<" ";
    cout<<endl;
}
Posted by: Guest on February-02-2021

Code answers related to "set <> c++"

Browse Popular Code Answers by Language