I want to perform this kind of operation using a set
:
set<int> s;
for (int i=0;i<n-1;i ){
for(int j=i 1;j<n;j ){
cout << s[j];
}
}
CodePudding user response:
Oh, Are you looking for this.
What you want to achieve is can be done with the help of C Iterators.
set<int> st = {4, 3, 5, 6};
set<int>::iterator it1, it2;
for (it1 = st.begin(); it1 != st.end();) {
for (it2 = it1 ; it2 != st.end(); it2 ) {
cout << (*it2) << space;
}
cout << endl;
}
Output
3 4 5 6
4 5 6
5 6
6
Read more about them from here.