String output for a polynomial

Feb 1, 2011 at 9:26pm
I'm currently working on an assignment involving classes and Polynomials and one of the assignments is to implement a function:

string str();

which will return a string representation of a polynomial in the form ax^2+bx+c. if a = 0, it will output bx+c, and so forth. I have a, b and c.

I'm not sure where to begin with this - stringbuf seems to be a way, but I have no clue how to use it or if it's even the correct way to go about this.
Feb 2, 2011 at 12:03pm
Use stringstream. It works like cout, just when you want to get the string call .str() method.
There is a reference on this site, look there.
Topic archived. No new replies allowed.