//判断边界,大于0小于200,出界返回false
if((triangle.lbordera>0&&triangle.lbordera<200)
&&(triangle.lborderb>0&&triangle.lborderb<200)
&&(triangle.lborderc>0&&triangle.lborderc<200))
{
//判断两边之和大于第三边
if((triangle.lbordera<(triangle.lborderb+triangle.lborderc))
&&(triangle.lborderb<(triangle.lbordera+triangle.lborderc))
&&(triangle.lborderc<(triangle.lbordera+triangle.lborderb)))
istrue = true;
}
return istrue;
}
/**
* 判断三角形类型
* 等腰三角形返回字符串“等腰三角形”;
* 等边三角形返回字符串“等边三角形”;
* 其它三角形返回字符串“不等边三角形”;
*/
public string istype(triangle triangle)
{
string strtype = "";
// 判断是否是三角形
if(this.istriangle(triangle))
{
//判断是否是等边三角形 if(triangle.lbordera==triangle.lborderb&&triangle.lborderb==triangle.lborderc)
strtype = "等边三角形";
//判断是否是不等边三角形
else if((triangle.lbordera!=triangle.lborderb)&&
(triangle.lborderb!=triangle.lborderc)&&
(triangle.lbordera!=triangle.lborderc))
strtype = "不等边三角形";
else
strtype="等腰三角形";
}
return strtype;
}
}