to solve for the variables y and x we substitute the second equation into the first meaning that y = -x +2 you substitute y for (-x+2)
so
(-x +2) = x +4
add x to both sides
2 = 2x + 4
subtract 4 from both sides
-2 = 2x
divide by 2
-1 = x
now plug x back into the original equation
y = (-1) + 4
y = 3
and
y = -(-1) + 2
y = 1 +2
y = 3
there you have it x = -1 and y = 3
Hope this helps ;)