I know this is a little late. But your program works if the equations are of the form
ax+by=e
cx+dy=f

do a little math and we get

ax+by=e <=> ax=e-by <=> x=(e-by)/a
cx+dy=f <=>...