The problem is that in the false_swap2 function the parameters must be declared as reference parameters. The procedure in its current form only swaps the values of the local variables a and b without affecting x and y. The correct version of false_swap2 would be

void swap2(int& a, int& b)
{  
   int temp = a;
   a = b;
   b = temp;
}