Question: Done in C++ Write a complete program to use Heron's formula to calculate the area A of a triangle with sides a, b and c.

Done in C++Done in C++ Write a complete program to use Heron's formula to

Write a complete program to use Heron's formula to calculate the area A of a triangle with sides a, b and c. The formula is as follows: = [s(s-a)(s-b)(s-c)] where (a+b+c) 2 S = Your function must accept a,b,c as parameters from a calling function (i.e. from your main function). Then it should calculate the values of 's', and [s (s - a) (s - b) (s - c)]. If this quantity is positive, the function calculates 'A' and returns this value. If the quantity is negative, it means the given values of a,b,c cannot form a triangle, hence it must return the value of A as -1. The value of A is returned by the function, and displayed on the screen as 'The area of the triangle is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!