What do you expect the output to be? Your y variable is uninitialized.
Try initializing the value to be 3.
1 2
int x = 3;
cout << even(y);
and therefore has a garbage value (actually undefined behavior).
Edit: Also, you have a global variable called "x" that is not doing anything and is shadowed by the x in your even function, I would not suggest doing this.