Say I'm given an expression like
(1/2) + (3/4) + (5/8) + (2/10) + (3/2) + (10/1)
How might I go about computing this expression as a float value in such a way that if the expression where to change I could still compute it?
I initially thought I could parse it from a string but ran into big problems. I then shifted to manually cutting the values into two arrays - Denominators and numerators but I felt that that was cheating the spirit of the exercise a bit. It also wouldn't allow flexibility in terms of the values presented.
Can this be done without 3rd party libraries and the like?