Пример #1
0
        private void btnCalculus_Click(object sender, EventArgs e)
        {
            PostfixNotation pn = new PostfixNotation(tbOriginalFunction.Text.ToString());

            List<string> var = pn.getVar();

            initializeDataGridView(var);

            calculusExpression(pn);
        }
Пример #2
0
        private void calculusExpression(PostfixNotation pn)
        {
            int n = pn.getVar().Count;
            Expression exp = pn.convertToExpression();

            for (int i = 0; i < dgvTableTrue.RowCount; i++)
            {

                List<bool> tmp = new List<bool>();

                for (int j = 0; j < dgvTableTrue.ColumnCount - 1; j++)
                {
                    tmp.Add(dgvTableTrue[j, i].Value.ToString() == "True");
                }

                dgvTableTrue[n, i].Value = exp.calculate(tmp) ? "True" : "0";
            }
        }