有编程的高手吗? 进来帮我看看 这段代码哪错拉`` 很简单的`C#的

来源:百度知道 编辑:UC知道 时间:2024/05/03 04:26:22
static void Main()
{
Application.Run(new Form1());
}

private void button2_Click(object sender, System.EventArgs e)
{
Application.Exit();
}

private void textBox2_TextChanged(object sender, System.EventArgs e)
{
textBox2.Text=Convert.ToDouble;
}

private void textBox1_TextChanged(object sender, System.EventArgs e)
{
textBox1.Text=Convert.ToString;
}

private void button1_Click(object sender, System.EventArgs e)
{
double weight,price;
int i;
weight=Convert.ToDouble(textBox1.Text);
i=(int)(weight/15);
switch(i)
{
case 0:price=5;break;
case 1:price=9;break;
case 2:price=12;break;
case 3:price=14;break;
case 4:price=15;break;
default:price=15+(int)((weight-75)/10+1);break;

}
}
}
}

在回答前你至少要把编译器报的什么问题说出来吧?!
======================

星星小侠:

你应该可以看的出来这个是程序段的一段代码吧?!
人家考的时候多选了几个部分而已.别"鸡蛋里挑骨头"

另外想想也可以知道啊,如果楼主多了或者少了括号编译器又不是傻子...楼主看到了编译结果说"应该有{"的时候就不会查找了么?问题肯定不出在这里.所以我说要有便宜器的结果

=================
楼主:

你这个代码我很不理解:
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
textBox1.Text=Convert.ToString;
}

你为什么在输入的时候要转换成String,计算的时候又转成双精啊?
小心变量类型不同,结果的值也不同啊...

我没细看,但一看就知道你的括号有多有少,你检查一下吧.