条件语句肯定取值有问题,自己检查下
要不就在for循环加一句显示,看看各值最后的值是多少
如
MessageBox.show(String.Format("{0},{1},{2},",totalSecond ,a * 60 - n * m,a * 60 - n * m - n * c));
然后你就知道原因啦
循环体要加括号。。。
for (n = 1; n < 100000;n++ )
{ if ((totalSecond <=a * 60 - n * m)&(totalSecond >=a * 60 - n * m - n * c))
{
timer2.Enabled = true;
}
else
timer2.Enabled = false;
}
for后面没有大括号啊!
中间是&&吧!
if加大括号了,else也加上吧!
与是不是应该&&啊
&是位操作符