private void CurrentAddMemory_Click(object sender, EventArgs e) { //MainDisplay.Text = Expression + "+" + MainDisplay.Text; ReversePolishEntry rpe = new ReversePolishEntry(MainDisplay.Text); MainDisplay.Text = rpe.Calculate(rpe.RPEformer(Expression + "+" + rpe.Expression)); }
private void CurrentSubMemory_Click(object sender, EventArgs e) { //MainDisplay.Text = Expression + "-" + MainDisplay.Text; ReversePolishEntry rpe = new ReversePolishEntry(MainDisplay.Text); if (rpe.Expression[0] != '-') { MainDisplay.Text = rpe.Calculate(rpe.RPEformer(Expression + "-" + rpe.Expression)); } else { MainDisplay.Text = rpe.Calculate(rpe.RPEformer(Expression + rpe.Expression)); } }
private void Equally_Click(object sender, EventArgs e) { try { ReversePolishEntry rpe = new ReversePolishEntry(MainDisplay.Text); if (rpe.error == null) { MainDisplay.Text = rpe.Calculate(rpe.RPEformer(rpe.Expression)); } } catch (Exception exception) { ReversePolishEntry rpe = new ReversePolishEntry(); rpe.error = "Wrong expression!"; } }