private double Brackets() { double result = 0; if (currentChar == Expression.Length) return result; while (Match("(") || Match(")")) { if (CurrentChar == '(') { currentChar++; if (Expression.LastIndexOf(')') == -1) { Console.WriteLine("Нету закрывающей скобки"); return result; } Calculator calc = new Calculator(); result = calc.Calculate(Expression.Substring(currentChar, Expression.LastIndexOf(')') - currentChar)); currentChar = Expression.LastIndexOf(')') + 1; return result; } if (CurrentChar == ')') { currentChar++; Console.WriteLine("Нету открывающей скобки"); return result; } } return Digits(); }
private static void Main(string[] args) { string expression; expression = "2^3^5"; //expression = Console.ReadLine(); if (expression == "") return; Calculator calc = new Calculator(); Console.WriteLine("{0} = {1:N10}", expression, calc.Calculate(expression)); Console.ReadLine(); }
/// <summary> /// Constructor. /// </summary> public CalculatorForm() { InitializeComponent(); calculator = new Calculator(); }
public void Setup() { _sut = new Calc.Calculator(); }
public void CreateCalculator() { _calculator = new Calculator(); }
public static void Main(string[] args) { Console.WriteLine("===== Console Calculator ====="); Calculator calc = new Calculator("WPCalc"); try { calc.start(); } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); } // Ctrl + c to end. }