The area of an arbitrary triangle can be computed using the formulaarea = √(s(s–a)(s–b)(s–c))where the square root is applied to the entire product (Links to an external site.) and where a, b, and c are the lengths of the sides, and s is thesemiperimeter  of the triangle given (Links to an external site.) by the formula:s = (a + b + c)/2 Write a void function named (Links to an external site.) triangle  that computes the area and perimeter(as well as the semiperimeter which will be used to compute the area)of a triangle based (Links to an external site.) on the length ofthe sides. The function should use five parameters (Links to an external site.)—three value (Links to an external site.)parameters (Links to an external site.) that provide the lengths of the edges and two referenceparameters (Links to an external site.) that store (Links to an external site.) the computed area and perimeter respectively. Make yourfunction robust. Note that not all combinations of a, b, and cproduce a triangle. Your function should produce correct resultsfor legal data and reasonable results for illegal combinations. Includein your submission a driver that repeatedly reads in 3 positive numbers thatare the sides of a triangle, and each time print out the sides and the areaand perimeter calculated by the triangle function. Your program (Links to an external site.) shouldterminate when the first side typed (Links to an external site.) in a group of three is negative or zero.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The area of an arbitrary triangle can be computed using the formula

area = √(s(s–a)(s–b)(s–c))

where the square root is applied to the entire product (Links to an external site.) and where a, b, and c are the lengths of the sides, and s is the
semiperimeter  of the triangle given (Links to an external site.) by the formula:

s = (a + b + c)/2


Write a void function named (Links to an external site.) triangle  that computes the area and perimeter
(as well as the semiperimeter which will be used to compute the area)
of a triangle based (Links to an external site.) on the length of
the sides. The function should use five parameters (Links to an external site.)—three value (Links to an external site.)
parameters (Links to an external site.) that provide the lengths of the edges and two reference
parameters (Links to an external site.) that store (Links to an external site.) the computed area and perimeter respectively. Make your
function robust. Note that not all combinations of a, b, and c
produce a triangle. Your function should produce correct results
for legal data and reasonable results for illegal combinations. Include
in your submission a driver that repeatedly reads in 3 positive numbers that
are the sides of a triangle, and each time print out the sides and the area
and perimeter calculated by the triangle function. Your program (Links to an external site.) should
terminate when the first side typed (Links to an external site.) in a group of three is negative or zero.

 

 

 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education