我已经编写了这段代码,我在 if(tot=100) 出现错误,双精度类型的文字不能隐式转换为十进制
//value in textboxes
decimal p1 = Convert.ToDecimal(TextBox2.Text);
decimal p2 = Convert.ToDecimal(TextBox3.Text);
decimal p3 = Convert.ToDecimal(TextBox4.Text);
decimal p4 = Convert.ToDecimal(TextBox5.Text);
decimal p5 = Convert.ToDecimal(TextBox6.Text);
decimal p6 = Convert.ToDecimal(TextBox7.Text);
//adding all the p's
decimal tot = p1 + p2 + p3 + p4 + p5 + p6;
if (tot = 100.00)
{
Label2.Text = "Percentage is 100"
}
else
{
Label2.Text = "Total of percentages is not 100.";
}