if (i != j && vect[j] == vect[i])
Let's go through this step by step.
Because i is equal to j.
We do this check, because we don't want to compare a value to itself.
We move on. In nested for-loops, the nested loop (j) iterates all the way to the end, before the parent loop continues.
It looks kind of like this:
i = 0, j = 0
i = 0, j = 1
i = 0, j = 2
i = 1, j = 0
i = 1, j = 1
i = 1, j = 2 |
etc.
So the next iteration is going to be:
Because i isn't equal to j.
Here we test if the value in vect at j is the same as the value in vect at i. We aren't assigning anything to anything (just for clarification).
Let's pretend that vect[j] and vect[i] are the same, in which case we would get...
if(i != j && vect[j] == vect[i])
True, because i isn't equal to j and the value of vect at j is the same as the value of vect at i.
Hope this helped.