One correction: this isn't linear algebra, which usually means matricies of multiple equations and unknowns.
Your example certainly isn't complex.
What you need is a simple expression grammar and parser. Parse the equation into an abstract syntax tree and walk the tree to evaluate it.
If you were writing Java it might look like this. Another example is symja. Perhaps it'll be enough inspiration for you to come up with your own for C++.
You might also want to look into Mathematica and Wolfram's Alpha. Stephen Wolfram is one of the world's best mathematicians and computer scientists. He's got a lot of stuff that you could reuse to good advantage rather than writing it yourself.
You'll have to define what you mean by "solve" and what you expect to have returned.
There are symbolic solutions and numerical solutions. Which one do you mean? Both are equally valid, but they're different. You'll apply different techniques depending on your answer.
Another point: there are many techniques for "solving" equations that depend a great deal on the type of equation. If you give me something like f(x) = 0
I think of root finding algorithms like Newton's method. If you give me an ordinary differential equation I might try a substitution method or numerical integration using Runge-Kutta. If you give me a partial differential equation I can apply finite difference, finite element, or boundary element techniques. (Don't get me started on elliptical, parabolic, and hyperbolic PDEs.)
The point is that your question is very generic, and the answer depends a great deal on what you're trying to do. More detail might help.