In a triangle, the sum of the lengths of any two sides is greater than the length of the other third side. Write a program triangle.cc that prompts a user to enter the lengths of three sides, checks if they form a triangle, and outputs if it is an isosceles, equilateral, scalene, or right triangle. Also, your program should output the perimeter and the area of the triangle. In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. An isosceles triangle has two sides of equal length. An equilateral triangle has all three sides with the same length. A scalene triangle has no equal sides. Your program should define and use the following functions: (a) isTriangle - takes the 3 sides of a triangle and returns true if they form a triangle, false otherwise. (b) isIsosceles - takes the 3 sides of a triangle and returns true if they form an isosceles triangle, false otherwise. (c) isEquilateral - takes the 3 sides of a triangle and returns true if they form an equilateral triangle, false otherwise. 1 CPSC 1620 Assignment 6 2 (d) isRight - takes the 3 sides of a triangle and returns true if they form a right triangle, false otherwise. (e) perimeter - takes the 3 sides of a triangle and returns its perimeter. (f) area - takes the 3 sides of a triangle and returns its area. (g) perimeterArea - takes the 3 sides of a triangle and returns its perimeter and area. It should call the function perimeter and area. The perimeter and the area of a triangle are defined as follows: Given the 3 sides of a triangle are a, b, and c. T riangle perimeter = a + b + c s = a + b + c 2 T riangle area = q s(s − a)(s − b)(s − c) You program should run repeatedly until the user wants to qui
] In a triangle, the sum of the lengths of any two sides is greater than the length
of the other third side. Write a program triangle.cc that prompts a user to enter
the lengths of three sides, checks if they form a triangle, and outputs if it is an isosceles,
equilateral, scalene, or right triangle. Also, your program should output the perimeter and
the area of the triangle. In a right triangle, the square of the length of one side is equal
to the sum of the squares of the lengths of the other two sides. An isosceles triangle has
two sides of equal length. An equilateral triangle has all three sides with the same length.
A scalene triangle has no equal sides. Your program should define and use the following
functions:
(a) isTriangle - takes the 3 sides of a triangle and returns true if they form a triangle,
false otherwise.
(b) isIsosceles - takes the 3 sides of a triangle and returns true if they form an
isosceles triangle, false otherwise.
(c) isEquilateral - takes the 3 sides of a triangle and returns true if they form an
equilateral triangle, false otherwise.
1
CPSC 1620 Assignment 6 2
(d) isRight - takes the 3 sides of a triangle and returns true if they form a right
triangle, false otherwise.
(e) perimeter - takes the 3 sides of a triangle and returns its perimeter.
(f) area - takes the 3 sides of a triangle and returns its area.
(g) perimeterArea - takes the 3 sides of a triangle and returns its perimeter and
area. It should call the function perimeter and area.
The perimeter and the area of a triangle are defined as follows:
Given the 3 sides of a triangle are a, b, and c.
T riangle perimeter = a + b + c
s =
a + b + c
2
T riangle area =
q
s(s − a)(s − b)(s − c)
You program should run repeatedly until the user wants to qui
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images