1
I have a little program that inserts a few integers into a set, and removes when I find the same one, after doing this, I need to bring out all the integers that are still inside the set, but I’m not able to do to go through the set and bring the information I want. Follows the code:
#include <stdlib.h>
#include <iostream>
#include <set>
using namespace std;
int main (){
int n,k,x;
set <int> di;
set <int>:: iterator it;
cin>>n;
for(int i=0; i<n; i++){
cin>>k;
for (int j=0; j<k; j++){
if (i!=0){
cin>>x;
it = di.find(x);
if (it!=di.end())
di.erase(it);
}
else{
cin>>x;
di.insert(x);
}
}
}
it = di.begin();
while(it!=di.end()){
cout<<⁢
di.erase(it);
it++;
}
}