Hi i need help in c++ vectors ... if you have a vector lets say 1,4,5,6,4,6,7 and you have to remove the duplicate vectors i.e to bring it in the form
1,4,5,6,7
....
i tried the double nested loop and trying to get the first vector and comparing with the other vector loops and then if it matches it deletes the vector entery... ( dun knw if its the rite way to do or not )
void alternating_sum(vector<double>& a) {
double even=0;
double odd=0;
double sum=0;
for (int i=0;i<a.size()/2;i++){
v1=a[i];
for (int j=0; j<a.size()/2;i++){
v2=a[j];
if (v1==v2){
double last_pos= a.size()-1; a[j]=a[last_pos];
a.pop_back();}
could someone help me .. i am just stuck on the part how could i match the first i entery with the other j entery and then delete if its the same or move on ... i tried the above code but gives out error some help would be nice
and could someone let me knw if i am doing it rite or not