新手求救,程序逻辑错误....
private void timer2_Tick(object sender, EventArgs e)
{
Countday();
timer2.Interval = 5000;
beginkm++;
this.textBox6.Text = beginkm.ToString();
}
public void Countday()
{
//int j = Convert.ToInt32(this.textBox6.Text);
int j = beginkm;
if (j == 1)
{
sum = 5;
}
if (j > 1 &&j <= 7)
{
double step1 = 1;
step1 = step1 * 1.4;
sum += step1;
}
else if (j > 7 && j <= 60)
{
double step2 = 1;
step2 *= 2.1;
sum += step2;
}
else
{
double step3 = 1;
step3 *= 1.4;
sum += step3;
}
this.textBox7.Text = sum.ToString() ;
}
当我执行结果
公里数 价格
1 5
2 5
3 6.4
4 7.8
为什么第二次没有的值没有加呢,不知道为什么,请高手帮我看看啊...