Manipulation and analysis of Mathematical Equations

The title is a bit long, but esentialy it is too the point.

Anyway, I at the begining of the day I was completely out of ideas of what to program, so I decided to try my luck at using C++ to do some mathematical equations.

The problem that I am having is that once I have got the equation in as a string (got a list of variables and their multipliers / dividers) I am stuck as too how to go about manipulating this data.

What is the best way of doing this. For the basics I just have a whole group of switch and ifelse statements and for loops, but this is getting way out of control.

Any help would be greately apreciated.

What I am planning to do with the equations is find such things as their derivatives and also their solutions for a given set of variables.

Thanks heaps.