The equations can be stored anywhere.It's easy enuf to store the equations - IF YOU HAVE THE EQUATIONS! That's your problem, you're assuming that all you are doing is storing coefficients.
// assumes equation has "a" and "b" in itThere's your problem. Your program is not smart enuf to figure out the coefficients A && B. What if I give you a table of:
a = prompt("Enter A:")
b = prompt("Enter B:")
CREATE TABLE MyData(x INT, y INT)
INSERT INTO MyData VALUES(1,0)
INSERT INTO MyData VALUES(3,1)
INSERT INTO MyData VALUES(5,2)
and I told you the equation was of the form:
y = mx + b
Now give me a program that uses the above data to derive m and b. Don't give me a program asking the end user to give me m & b. When you get that done, then start changing the form of the equation around, adding more variables and various combinations of power orders. Something simple like:
y = a + b*x + c*x*x + d*x*z + e*z*z + f*z
And don't ask the operator to supply the a,b,...f coefficients.