I am to create a project that evaluates math expressions and their derivatives. I have a Formula class with only virtual functions:
virtual void print()
virtual void print(int)
virtual Formula *derivative()
virtual int evaluate()
Then I have 7 other classes which inherent from Formula, they are:
Variable
Constant
Add
Multiply
Subtract
Divide
Exponent
These classes are to have constructors and destructors along with overriding the virtual functions.
I am reading the expression from a file, where are an expression such as 3*x looks like:
*
3
x
Can someone please help me with this?