コード例 #1
0
        static void testEvaluaExpresion()
        {
            string cad = "21.8+3-5/3.11*(10+6+2)+4";

            cad = TextUtils.DelEmptyString(cad);
            Console.WriteLine("Evalua la expresion --> " + cad);
            try {
                Expression expr = new Expression(new TokenStream(cad.Trim()));
                double     d    = expr.EvaluaExpression();
                Console.WriteLine(d);
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }