C and C++ does not have an eval
type functionality - that is because the language is compiled, and it would require an entire compiler to be part of the runtime if you wanted to be able to "compile some more code" - never mind the difficulties with referencing for example existing variables.
For this type of expression, it's not terribly hard to write some code that parses and evaluates the expression - it requires a stack to deal with the parenthesis, and some simple operators, but that's not terribly hard to do.
Obviously, integrating an existing scripting language would also work.