Пример #1
0
int main(int argc, char* argv[]) {
  Calculator calculator;
  cout << "First Step" << endl;
  // should print 5.85714
  cout << calculator.Calc("3 + 4 * 5 / 7") << endl;

  cout << "\nSecond Step" << endl;
  // should print a 5
  cout << calculator.Calc("( 3 + 4 ) * 5 / 7") << endl;

  cout << "\nThird Step" << endl;
  // should print 3 and 243. 3 for "pi" and 243 for "9 * 9 * 3".
  vector<double> output = calculator.CalcWithVars(
      { "pi = 3", "pizza = 9 * 9 * pi" });
  for (size_t i = 0; i < output.size(); ++i) {
    cout << output[i] << endl;
  }
}