I have yet another question.
I want to input a polynomial of the form:
a_1x^n + a_2x^(n-1) +...+ a_(n-1)x^2 + a_nx + d
as a string of characters and convert this to a function. (n are integers, a,d are floats.)
For individual terms, I thought I could do something like:
1.) Check for the character 'x' in the term.
2.) IF 'x' is present in term
THEN do 3.)
ELSE return constant (d)
3.) IF 'x' is preceeded by '^'
THEN declare a new integer and set it equal to the number succeeding '^', declare a float and set it equal to the number precceding x, and calculate a*x^n for this term.
ELSE declare a float and set it equal to the number precceding x, and calculate a*x for this term.
I would also first have to do something to check for +/- characters, and then identify each of the terms before applying 1.)-3.) on them.
The main problem is how to do the checking of sucedding/preceeding characters/strings in the main inputted char variable. Is this even possible in c, or does it go back to my previous thread where we have to use windows/linux specific functions?