You build the expression you wish to calculate as a tree of operators and operands:
class Node;
class operator : public node { virtual double eval() };
class operand : public node ;
class binary_operator : public operator ;
class addition : public binary_operator;
...etc.
This is the GOF Composite Pattern.
You build a GOF Visitor that visitor that visits nodes and evals recursively, so that by visiting the root of a expression results in evaling the whole tree and retuirning teh result of the expression.
You add reporting to the Visitor or a class derived from it. (It's helpful to have several subclasses of Visitor; one may report, another may verbosely log debug info, whatever, another may report in a different format, etc.)
I put something like this together with JavaCC (Java Compiler Compiler), which took care of generating code to parse an expression (I supplied the expression grammar in modified BNF) and build its expression tree for me; the eval and visitor code I wrote by hand.