boolean variable

Hi! I'm trying to write a code that given two input vectors the output is a third one made up of the non-common numbers between the first two. I think I should youe a boolean variable, but I can't manage to make it work.Thanks!

1
2
3
4
5
6
7
8
9
10
11
void differenza ()
{trovato='F';
 for (I=1; I<=N; I=I+1)
 {for (i=1;  i<=n; i=i+1)
   {if (V[I]==S[i])
     {trovato=='V';}
     if (trovato=='F')
 {k=k+1;
 D[k]==V[I];}}};
 Nk=k;}
  Put the code you need help with here.
code a is_member() function and an insert() function, then do
1
2
3
4
5
6
7
for( x in A ) //whatever you use to traverse your container
   if( not B.is_member(x) )
      Result.insert(x);

for( x in B )
   if( not A.is_member(x) )
      Result.insert(x);
Last edited on
Topic archived. No new replies allowed.