Description: For this assignment, you will create a function to calculate the maximum length of the third side of a tria

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Description: For this assignment, you will create a function to calculate the maximum length of the third side of a tria

Post by answerhappygod »

Description: For this assignment, you will create a function tocalculate the maximum length of the third side of a triangle andits hypotenuse. You will collect two side lengths from theuser.
Description For This Assignment You Will Create A Function To Calculate The Maximum Length Of The Third Side Of A Tria 1
Description For This Assignment You Will Create A Function To Calculate The Maximum Length Of The Third Side Of A Tria 1 (75.74 KiB) Viewed 18 times
#include <iostream>#include <cmath>#include <iomanip>#include <string>
using namespace std;
double maxLen(double, double);double hypot(double, double);
int main() {
double side1, side2, maxLength,hypotenuse; int i; for (i = 0; i < 3; i++) { cout << "Please enterthe two known sides of the triangle: "; cin >> side1 >>side2; maxLen(side1, side2); hypot(side1, side2); } return 0;}
double maxLen(double side1, double side2) { double maxLength; cout << fixed << showpoint <<setprecision(0); maxLength = side1 + side2 - 1; cout << "The maximum length of yout thirdside is: " << maxLength << endl; return maxLength;}double hypot(double side1, double side2) { double hypotenuse; cout << fixed << showpoint <<setprecision(2); hypotenuse = sqrt((pow(side1, 2) + (pow(side2,2)))); cout << "Your triangle's hypotenuse is: "<< hypotenuse << endl; cout << endl << endl;
return hypotenuse;}
Description: For this assignment, you will create a function to calculate the maximum length of the third side of a triangle and its hypotenuse. You will collect two side lengths from the user. Requirements: 1. Collect the length of two sides of a triangle from the user. 2. Within one function, calculate the maximum third +you may use the (++ sqrt() function for length of a triangle and its hypotenuse. Return the calculation. value of the hypotenuse to main(). 3. Display the results for the triangle's maximum third side and its hypotenuse in main(). Round the hypotenuse to the nearest 10th . 4. Run three sets of test data through your program. 5. Output must be labelled and easy to read as shown in the sample output below. 6. Program must be documented with the following: a. // Name b. // Date c. // Program Name d. // Description 7. Flowchart the logic of the program Sample Output: Sample Output: Please enter the two known sides of the triangle: 810 The maximum length of your third side is: 17 Your triangle"s hypentuse is: 12.81 Please enter the two known sides of the triangle: 36 The maximum length of your third side is: 8 Your triangle"s hypentuse is: 6.71 Please enter the two known sides of the triangle: 1219 The maximum length of your third side is: 30 Your triangle"s hypentuse is: 22.47
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply