I was trying to write a program for a vector which usually gives a list of value that will be going to occur more than once in an individual element. Code:
I had got the value which had being repeated but I want the unique list. I there any way to do so.Code:std::vector<int> v2; vec2[0]=6; vec2[1]=6;here 6 is coming twice. I want to ask if if I make a double loop std::vector<int> oc; { for (k=0; k<v2.size(); k++) { for (l=0; l<v2.size(); l++) { if(v2[k] == v2[l]){ oc.push_back(v2[k]); } the output will be oc[0]=6; oc[1]=6; oc[2]=6; oc[3]=6;
Bookmarks