0

I have this program

Define a function hypotenuse that calculates the length of the hypotenuse of a right triangle when the other two sides are given (22__hsideasideb=+). Use this function in a program to determine the length of the hypotenuse for each of the triangles shown below. The function should take two double arguments and return the hypotenuse as a double. Hint: Use cmath.h and the functions sqrt(double x), and pow(double x, int y).

Triangle Side 1 Side 2

```
1 3.0 4.0
2 5.0 12.0
3 8.0 15.0
```

## and i write this,not working to print the result

```
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double Hypotenuse(double sideA, double sideB);
/*********************************************/
double Hypotenuse(double sideA, double sideB)
{
double hypotenuse = 0.0;
hypotenuse= sqrt((sideA*sideA)+(sideB*sideB));
return hypotenuse;
}
int _tmain(int argc, _TCHAR* argv[])
{
double sideA=0.0;
double sideB=0.0;
double hypotenuse= 0.0;
int i;
for(i=1;i<=3;i++){
cout<<"Enter the first side for the triangle: ";
cin>>sideA;
cout<<"Enter the second side for the triangle: ";
cin>>sideB;
cout<<endl;
hypotenuse = Hypotenuse(sideA, sideB);
}
cout<<"Trinagle "<<" "<<"Side 1"<<" "<<"Side 2"<<" "<<"Hypotenuse"<<endl;
cout<<"-------------------------------------"<<endl;
cout<<endl;
for(i=1;i<=3;i++)
{
cout<<setw(5)<<i <<setw(5)<<sideA<<setw(5)<<sideB<<setw(5)<<hypotenuse<<endl;
}
system("pause");
return 0;
}
```