Answered step by step
Verified Expert Solution
Link Copied!

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++image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago