implementation of the calculus functions i.e f(x), in programming

Viewed 349

I want to write a program that calculates a given math function (by the user) with specific set of values.

The user is asked to type a function, say he typed f(x)= (x^2)+3x+1 then through the program I should show the outputs of [ f(3), f(6) and f(9) ] .

The question specifically is how to fetch these x's in the typed function, then how to convert the function from a string to a double or float.

Do you have any thoughts about that ?

suppose that I'm using C , or C++

1 Answers
Related