you do seem to do a lot of string manipulation which may not be necessary at all.
string s = poly;
s = "+" + s;
would be more efficiently written as
string s = "+" + poly;
for example.
while (index != string::npos)
{
s = s.substr(index+1);
chars = sscanf(s.c_str(),"%lf *x** %d",&cof,&exp);
are you sure you want to do this?
My guess is you intend to do something along the lines of
while (index != string::npos)
{
chars = sscanf(s.substr(index+1).c_str(),"%lf *x** %d",&cof,&exp);
P.S. Use C++ style braces and indentation.
Also use code tags when posting code...
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337