关于计算机器的实现????
我做的计算机器的/,*,-,+一直按下去的话,它会一直在运算的,可是真正的计算机器不是这样的啊,我的运算符的代码是这样的,帮我看看啊,大侠们private void Oper_Click(object sender, EventArgs e)
{
this.curVal = float.Parse(this.textBox1.Text);
this.append = false;
if (this.preOper == null)
{
this.preOper = ((Button)sender).Text;
this.prevVal = curVal;
return;
}
switch (this.preOper)
{
case "+": this.prevVal += this.curVal; break;
case "-": this.prevVal -= this.curVal; break;
case "*": this.prevVal *= this.curVal; break;
case "/": this.prevVal /= this.curVal; break;
default: break;
}
this.textBox1.Text = this.prevVal.ToString();
this.preOper = ((Button)sender).Text;
}