Question: I need a C++ programming code that calculates the hypotenuse of a right triangle using the following information: For all programs, brief comments are required
I need a C++ programming code that calculates the hypotenuse of a right triangle using the following information:
For all programs, brief comments are required as follows:
All preprocessor directives
All function prototypes
All variables and arrays prototypes when defined
Description of the output fromprintf()
Make a program to calculate the hypotenuse of a right triangle. The values for the sides of the triangle will be input from the keyboard; the hypotenuse will be calculated using the equation c = (a^2+ b^2 ) where c is the length of the hypotenuse; a and b are the length of the two sides. (c is equal to the square root of the sum of a squared and b squared) (Requires the use of the SQRT() and POW() functions.
Draw the flow chart for the program.
Functions required:
Print the header shown above before entering a loop.
Use a loop to input side a and side b, until side a is -1
Calculate the length of the hypotenuse
oValues should be output using 3 decimal place precision (hint: %3.3lf)
Print the results of all tests of a and b
Print the array holding the results
Use column headings for the output display
All values displayed in 3 decimal-place precision
Program execution:
Define the array in main
oKeep in mind the results of the calculations could have decimal places
Populate the array as described above but set the element that will contain the hypotenuse to 0 (zero).
Call the print function
oDisplay the results in table format, including appropriate column headings
oUse 3 decimal place precision
Call the calculate function
oPass the sideaandbvalues from the array
oPopulate the appropriate array element with the value returned for the hypotenuse
Call the print function
oDisplay the results in table format, including appropriate column headings
oUse 3 decimal place precision
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
