123
std::stringstream str; str<<"1"<<23<<"/"<<"x"; std::cout<<str.str(); //this gets the string version of what you put in
123/x
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
string Polynomial::str() { std::stringstream str1; std::stringstream str2; std::stringstream str3; std::stringstream stra; std::stringstream strb; std::stringstream strc; stra << a; strb << b; strc << c; if (a == 0) str1; else; { str1 << stra << "x^2 "; } second: if (b == 0) str2; else; if (b > 0) { str2 << "+ " << strb <<"x "; } else; if (b < 0) { str2 << "- " << strb << "x "; } third: if (c == 0) str3; else; if (c > 0) str3 << "+ " << strc; else; if (c < 0) str3 << "- " << strc; return (str1 << str2 << str3); }