Основы объектно-ориентированного программирования на языке C# book | Page 196

8 Вправи static void Main(string[] args) { Expressions.ArithmeticOps.Register(); Console.WriteLine("Enter arithmetic expression: "); string expr = Console.ReadLine(); try { Console.WriteLine("Result: {0}", Expressions.Expression.Eval(expr)); } catch (Expressions.Expression.ExpressionSyntaxError e) { ConsoleColor c = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(new string(’ ’,e.Where) + ’^’); Console.WriteLine("ERROR: {0}", e.Message); Console.ForegroundColor = c; } } } 196