Double sum = 0;
Boolean blnClear = false;
String strOper="+";
//《求助代码区》
private void btnjiahao_Click(object sender, EventArgs e)
{
//为加号按钮区
double dbSecond = Convert.ToDouble(textBox1.Text);
if (!blnClear)
switch (strOper)
{
case "+": sum += dbSecond; break;
case "-": sum -= dbSecond; break;
case "*": sum = sum * dbSecond; break;
case "/": sum = sum / dbSecond; break;
}
if (sender == btnjiahao)
strOper = "+";
if (sender == btnjianhao)
strOper = "-";
if (sender == btnchenghao)
strOper = "*";
if (sender == btnchuhao)
strOper = "/";
if (sender == btndenghao)
strOper = "=";
textBox1.Text = Convert.ToString(sum);
blnClear = true;
}
Boolean blnClear = false;
String strOper="+";
//《求助代码区》
private void btnjiahao_Click(object sender, EventArgs e)
{
//为加号按钮区
double dbSecond = Convert.ToDouble(textBox1.Text);
if (!blnClear)
switch (strOper)
{
case "+": sum += dbSecond; break;
case "-": sum -= dbSecond; break;
case "*": sum = sum * dbSecond; break;
case "/": sum = sum / dbSecond; break;
}
if (sender == btnjiahao)
strOper = "+";
if (sender == btnjianhao)
strOper = "-";
if (sender == btnchenghao)
strOper = "*";
if (sender == btnchuhao)
strOper = "/";
if (sender == btndenghao)
strOper = "=";
textBox1.Text = Convert.ToString(sum);
blnClear = true;
}