Assignment #6: Operator Overloading

Implement a Polynomial class. Support operator+, operator-, and operator*, as well as the corresponding assignment operators, operator==. operator!=, as well as an overloaded input and output operator. Add a public method, eval, that takes evaluates the polynomial at a particular point. You should use a good separation of interface and implementation.

The polynomial is implemented as a sorted vector of pairs, in which each pair represents a coefficient and an exponent. For instance, the polynomial x^2+4 is represented by a vector of size 2, with index zero containing (4,0) and index one containing (1,2). If this polynomial is represented by p, then p.eval(2) returns 8. You may assume that all coefficients are of type double and exponents are non-negative integers.

A polynomial can be constructed by passing a string. For instance,

Polynomial p( "x^2+8x+15" );
For simplicity, you may assume that there are no spaces in the string. This makes it easy to implement the required operator<<.

I have deliberately left some of the specification vague. In implementing the class, you need to make reasonable assumptions.