trunc analogy with int
Direct removal function trunc the fractional part of
INT is a function rounding down to the nearest integer.
TRUNC (-5.6) is the integer part of the result (-5)
### INT (-5.6) after the integer part of the result is rounded down (-6)
application:
- End rounding operations
- eg maximum pasture area multiplied by 100 and then round the result of the tail. If you can not build, output -1.
int helen(double a,double b,double c)//海伦公式求面积
{
if(a+b>c && b+c>a && a+c>b)
{
double p=(a+b+c)/2;
return trunc(sqrt(p*(p-a)*(p-b)*(p-c))*100);
}
else return -1;
}