示例#1
0
 private static void RunLoop(Calculator calculator)
 {
     while (true)
     {
         Console.ForegroundColor = ConsoleColor.Gray;
         var line = Console.ReadLine();
         if (line == null) break;
         var args = SplitInput(line);
         var result = calculator.Calculate(args);
         Console.ForegroundColor = result.HasValue ? ConsoleColor.Green : ConsoleColor.Red;
         Console.WriteLine("> " + result);
     }
 }
 public string[] SplitInput(string input)
 {
     return(Calculator.SplitInput(input));
 }
 public void SetUp()
 {
     calc = new Calculator();
 }
示例#4
0
        private static void Main()
        {
            Calculator calculator = new Calculator();

            RunLoop(calculator);
        }
示例#5
0
 private static void Main()
 {
     Calculator calculator = new Calculator();
     RunLoop(calculator);
 }