예제 #1
0
        private void PostfixNotationButton_Click(object sender, EventArgs e)
        {
            ListExpresstionTextBox.Clear();
            Notation ntn = new PostfixNotation();

            ShowExpression(ntn);
        }
예제 #2
0
        static void Main(string[] args)
        {
            // (3x^2 + 7) / (4x^3 + 5)
            Expression exp = new DivExpr(
                                new AddExpr(
                                    MonomialExpr.createObject(3, 2),
                                    ConstExpr.createObject(7)),
                                new AddExpr(
                                    MonomialExpr.createObject(4, 3),
                                    ConstExpr.createObject(5)));

            InfixNotation infix = new InfixNotation();
            PrefixNotation prefix = new PrefixNotation();
            PostfixNotation postfix = new PostfixNotation();

            Console.WriteLine(exp.ToString(infix));
            Console.WriteLine(exp.ToString(prefix));
            Console.WriteLine(exp.ToString(postfix));
        }