【发布时间】:2016-12-30 07:34:01
【问题描述】:
protected void BtnCal_click(object sender, EventArgs e)
{
{ double result = 0;
double width;
double length;
double radius;
double breath;
radius = (Convert.ToDouble(TextRadius.Text));
length = (double.Parse(TextLength.Text));
breath = (double.Parse(TextBreath.Text));
width = (Convert.ToDouble(TextWidth.Text));
if (DropDownShapes.SelectedValue == "cir")
{ double pi = 3.142;
result = radius * radius * pi;
TextWidth.Text = "0";
TextLength.Text = "0";
TextBreath.Text = "0";
}
else if (DropDownShapes.SelectedValue == "tri")
{ result = length * breath * 0.5;
TextWidth.Text = "0";
TextRadius.Text = "0";
}
else if (DropDownShapes.SelectedValue == "rec")
{ result = length * width;
TextRadius.Text = "0";
TextLength.Text = "0";
TextBreath.Text = "0"
}
else
{
TextArea.Text = result.ToString();
}
}
}
【问题讨论】:
-
有问题吗?