Think more about the logic
Right now, your numlenght
also has some logic that doesn't seem to me like it makes much sense at all:
if (i == poly.length() - 1)
{
break;
}
else
{
break;
}
It appears that the test in the if
statement makes no real difference at all--you're going to carry out the same action whether it's true
or false
. You might as well replace that whole chunk with break;
(but before you edit, see the next point below).
Use the standard library
Your numLenght
[sic] could be implemented a lot more easily using find_first_not_of
:
return poly.find_first_not_of("0123456789");
Names
At least to me, some of you names seem fairly meaningless. For example, I'm not sure what parHandler
is supposed to mean.
Conclusion
Ultimately, I agree with Loki Astari this this would be much better handled with a recognizable lexer and parser. Rather than post some code for that, I'll point you to a previous question previous question where both he and I posted our ideas of how to accomplish roughly what you're doing here.
Think more about the logic
Right now, your numlenght
also has some logic that doesn't seem to me like it makes much sense at all:
if (i == poly.length() - 1)
{
break;
}
else
{
break;
}
It appears that the test in the if
statement makes no real difference at all--you're going to carry out the same action whether it's true
or false
. You might as well replace that whole chunk with break;
(but before you edit, see the next point below).
Use the standard library
Your numLenght
[sic] could be implemented a lot more easily using find_first_not_of
:
return poly.find_first_not_of("0123456789");
Names
At least to me, some of you names seem fairly meaningless. For example, I'm not sure what parHandler
is supposed to mean.
Conclusion
Ultimately, I agree with Loki Astari this this would be much better handled with a recognizable lexer and parser. Rather than post some code for that, I'll point you to a previous question where both he and I posted our ideas of how to accomplish roughly what you're doing here.
Think more about the logic
Right now, your numlenght
also has some logic that doesn't seem to me like it makes much sense at all:
if (i == poly.length() - 1)
{
break;
}
else
{
break;
}
It appears that the test in the if
statement makes no real difference at all--you're going to carry out the same action whether it's true
or false
. You might as well replace that whole chunk with break;
(but before you edit, see the next point below).
Use the standard library
Your numLenght
[sic] could be implemented a lot more easily using find_first_not_of
:
return poly.find_first_not_of("0123456789");
Names
At least to me, some of you names seem fairly meaningless. For example, I'm not sure what parHandler
is supposed to mean.
Conclusion
Ultimately, I agree with Loki Astari this this would be much better handled with a recognizable lexer and parser. Rather than post some code for that, I'll point you to a previous question where both he and I posted our ideas of how to accomplish roughly what you're doing here.
Think more about the logic
Right now, your numlenght
also has some logic that doesn't seem to me like it makes much sense at all:
if (i == poly.length() - 1)
{
break;
}
else
{
break;
}
It appears that the test in the if
statement makes no real difference at all--you're going to carry out the same action whether it's true
or false
. You might as well replace that whole chunk with break;
(but before you edit, see the next point below).
Use the standard library
Your numLenght
[sic] could be implemented a lot more easily using find_first_not_of
:
return poly.find_first_not_of("0123456789");
Names
At least to me, some of you names seem fairly meaningless. For example, I'm not sure what parHandler
is supposed to mean.
Conclusion
Ultimately, I agree with Loki Astari this this would be much better handled with a recognizable lexer and parser. Rather than post some code for that, I'll point you to a previous question where both he and I posted our ideas of how to accomplish roughly what you're doing here.