Feb 4, 2011 at 7:54pm Feb 4, 2011 at 7:54pm UTC
Basically, I have three variables a, b and c, such that ax^2+bx+c = 0, and I have to print out the polynomial correctly (a b and c can all be either negative or zero). I'm not sure how to start on this, though - any hints would be appreciated
Feb 4, 2011 at 8:09pm Feb 4, 2011 at 8:09pm UTC
This is quite simple, do you know how to output stuff normally using a stringstream?
Feb 4, 2011 at 8:15pm Feb 4, 2011 at 8:15pm UTC
not really, and the cplusplus.com reference page is rather confusing to me
Feb 4, 2011 at 8:42pm Feb 4, 2011 at 8:42pm UTC
What would be the best way to take into account terms that are zero or negative? Should I use if/else statements or switching statements?
Feb 4, 2011 at 9:34pm Feb 4, 2011 at 9:34pm UTC
I would use if/else. Switch might work but wouldn't be any better IMO.
Feb 5, 2011 at 3:55am Feb 5, 2011 at 3:55am UTC
Call the .str() operator before you return it. You are returning a string, not a stringstream.