3. Example: Calculator

3.1. How Do We Evaluate An Expression?
3.2. Example: 2 / ( 1 + 3 )
3.3. Starting the Evaluation
3.4. Evaluating an Expression
3.5. Evaluating a Product
3.6. Evaluating a Term
3.7. Example: evaluating 2 / ( 1 + 3 )
3.8. Calculator Program

Consider a calculator program to evaluate expressions like 1.5 + ( 2 / 3 )

int main(int argc, char** argv)
{
  LListHeader<string> tokens;
  string token;
  while (cin >> token)
    tokens.addToEnd (token);

  cout << evaluate (tokens) << endl;

  return 0;
}

In the Forum:

(no threads at this time)