Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dave007

serious C++ problem

This topic is 6512 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!