Advertisement

serious C++ problem

Started by November 26, 2000 06:55 AM
-1 comments, last by Dave007 24 years, 1 month ago
Hi all, I have this problem in C++. I''m making math function parser with function simplification alghoritm. I have for eg. this fx: "x*2*x" I have code something like this:

CParser* CMultFx::GetDuplicate() const
{
...
...
while (_t->Type() == FX_MULT)
{
if (f1->GetName() == ((GMultFx*)_t)->f1->GetName())
{
return new GPowerFx(_f1, new GConstFx(2));
}
_t = ((GMultFx*)_t)->f1;
}
...
...
}
 
The result might be like this "2*x^2". But what the problem?? Declaration of my multiplication fx class CMultFx : public CParser { public: ... virtual GParser *GetDuplicate() const; ... GParser *f1; GParser *f2; }; so f1 is for eg "x" and f2 is "2*x" and i need to remove the "*x" part from the f2. Anyone knows how to do this?? Dave007 dave007@volny.cz
--------Dave[ Math Studio ] A Computer Algebra System

This topic is closed to new replies.

Advertisement