processing of user inputted mathematical expression
A. I am trying to develop a curve plotter which takes in user inputted equations[ eg y=t*t + cos(4*t) , x = 2*sin t ]
Then a loop is used
for(t=0; t<=10; t+=.1)
{
y = t*t + cos(4*t) ;
x = 2*sin t;
putpixel(fun1(x), fun2(y), WHITE); // fun1 and fun2 return appropriate pixel number
}
How can the user input the equations when the program runs?
B. I also want to know about precompiled headers.
Please help
I don't know about ' converting' the string obtained after fgets()
Referring to the reply by respected Mr. Vber,
I do not understand what is meant by " converting" the string obtained by fgets().
As it is clear from the code, I need to have the equations in the form of C code and then use them inside the loop.
I need to do this without having to compile the code again
after modifying the source file.
for(t=0; t<=10; t+=.1)
{
y = t*t + cos(4*t) ; // user inputted equations
x = 2*sin t;
putpixel(fun1(x), fun2(y), WHITE); // fun1 and fun2 return appropriate pixel number
}
I am using Borland C compiler on a DOS platform.