1

Possible Duplicate:
Evaluating arithmetic expressions in C++

I've created a class that handles rational arithmetic. i.e. has a constructor that accepts strings of the form "a/b", and instantiates an object with object.numerator = a, and object.denominator = b. I've also overload the arithmetic operators to deal with Rational objects.

My question is, I will be reading in lines from a file, such as: "a/b + c/d"

I know how to make sure both operands become Rational objects, but how do I pull the operator from the stream, and use it on the operands?

Thanks!

Community
  • 1
  • 1
AlmostSurely
  • 552
  • 9
  • 22
  • 3
    possible duplicate of [Custom interpreter for mathematical expressions](http://stackoverflow.com/q/6713983/), [What is the best way to evaluate mathematical expression in C++?](http://stackoverflow.com/q/5115872/), [Evaluating arithmetic expressions in C++](http://stackoverflow.com/q/9329406/) – outis Jul 05 '12 at 19:18
  • 1
    ... [How to evaluate any given expression](http://stackoverflow.com/q/10642959/) – outis Jul 05 '12 at 19:24

0 Answers0