Question #105750

Write a c++ program to calculate area of a circle using hero's formula

Expert's answer

If need to calculate the area of circle the function looks 

double Hero1(double r)

{

  const double PI=3.141592653589323846;

  return PI*r*r;

}

If need to calculate the area of triangle using formula heron’s the function looks 

double Hero2(double a, double b, double c)

{

  double s=(a+b+c)/2;

  return sqrt(s*(s-a)*(s-b)*(s-c));

}


LATEST TUTORIALS
APPROVED BY CLIENTS