In Python I have such an opportunity, to write string named s with something and then execute the code inside this string with exec() function:
s = input() # Something like 5*x**2-6
exec('def f(x):\n return ' + s)
print(f(5))
How can I do something like that in C++? In my program user is supposed to input some function, line segment and get the x from this segment, for which f(x) = 0. I got everything done, but the function f(x) for which equation is solved can only be changed in the source code, which is of course not very suitable.
Thanks in advance!