Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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++
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 isStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started