Question: C++ PROGRAMMING Create a program that calculates and outputs the area of a triangle under two circumstances. The program will print the area out twice.
C++ PROGRAMMING
Create a program that calculates and outputs the area of a triangle under two circumstances.
The program will print the area out twice.
For the first output:
The triangle sides measure 3 and 4 at the beginning of the program.
Integers variables will be used to hold the values of the length of the sides and the area of the triangle.
Initially the area variable will hold a value of (be initialized to) zero.
The program then calculates the area of the triangle and places the result of the calculation in the area variable.
The value of the three variables holding the side lengths and area are to then be output as shown below.
For the second output:
Double variables are to be used to hold the values of the length of the sides and the area of the triangle.
The side variables will be initialized to zero.
The program then multiplies the integer length values by five and places them in the double type side variables.
The program then calculates the area of the triangle using the new double type side values and places the result in the new double type area variable.
The value of the double type variables holding the side lengths and area are to be output as shown below.
The output should be with a single decimal place after the decimal point.
The program should produce the following output:
The sides of the triangle measure 3 and 4. The area is 6. The sides of the triangle measure 15.0 and 20.0. The area is 150.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
