Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

elements of set c++

//Method 1:
 set<int>:: iterator it;
 for( it = s.begin(); it != s.end(); ++it){
    int ans = *it;
    cout << ans << endl;
 }
//Method 2:
 for( auto& it : s) {
     cout << it << " ";
 }
 
PREVIOUS NEXT
Tagged: #elements #set
ADD COMMENT
Topic
Name
3+3 =