111,098
社区成员




private void btn_右括号_Click(object sender, EventArgs e)
{
textBox1.Text += ")";
bool flag = true;
OPND.Push(txtDisplay.Text);
txtDisplay.Text = "";
op2 = ")";
while (flag)
{
if (OPND.Count >= 2)
{
op1 = Convert.ToString(OPTR.Pop());
if (Isp(op1) > Icp(op2))
{
num2 = Convert.ToDouble(OPND.Pop());
num1 = Convert.ToDouble(OPND.Pop());
if (op1 == "+")
{
tempresult = num1 + num2;
}
else if (op1 == "-")
{
tempresult = num1 - num2;
}
else if (op1 == "×")
{
tempresult = num1 * num2;
}
else if (op1 == "÷")
{
tempresult = num1 / num2;
}
OPND.Push(Convert.ToString(tempresult));
}
else if (Isp(op1) == Icp(op2) )
{
flag = false;
}
}