Let the two digit number be xy, The sum of the two digits is 12:
x + y = 12
The value of the number obtained by switching the digits (yx) is 18 more than the original number (xy). Recall that the first digit is in the "tens" place and the second is in the "ones" place, so:
10y + x = 10x + y + 18
9y - 9x = 18
Solve the system of equations:
x + y = 12
-9x + 9y = 18