168k views
2 votes
The length of the hypotenuse of a right-angled triangle is the square root of the sum of the squares of the other two sides. Write a function calcH that accept two doubles as function arguments and returns a double. Prompt the user for the length of base and the perpendicular side of the triangle. Use the pow and sqrt functions from cmath to perform the calculations.

1 Answer

3 votes

Answer:

# include<cmath>

# include <iostream>

# include<stdio.h>

using namespace::std;

int main()

{

float a, b, c;

cout<<"Enter a (Perpendicular)"; cin>>a;

cout<<"Enter b (base)";cin>>b;

c= sqrt(pow(a,2) + pow(b,2));

cout<< "Hypotenuse="<<c;

return 0;

}

Step-by-step explanation:

Please check the answer section.

User Gleber
by
4.7k points