Hello, Everyone

Tonight, I was writing a pythagorean program which ask for the two sides and gives the hypothenuse of three different triangles. Here is the program:

The program compiles, however, I get the following result:Code:#include<iostream> using namespace std; #include<iomanip> using std::setw; using std::setprecision; using std::setiosflags; #include<cmath> double hypotenuse(double, double); int main() { double side1, side2, theHypotenuse; int first = 1; cout << "Enter the lengths of the two sides: "; for( int i = 1; i <= 3; i++) { cin >> side1 >> side2; if( first ) { cout << setw( 5 ) << "Triangle" << setw( 12 ) << "Side 1" << setw( 14 ) << "Side 2" << setw( 20 ) << "Hypotenuse" << "\n"; first = 0; // prevents this from printing again } cout << setiosflags( ios::fixed | ios::showpoint ) << setw( 3 ) << i << setw( 15 ) << setprecision( 1 ) << side1 << setw( 15 ) << setprecision( 1 ) << side2 << setw( 15 ) << setprecision ( 1 ) << hypotenuse << "\n"; } theHypotenuse = hypotenuse(side1, side2); // The function call return 0; } double hypotenuse(double side1, double side2) { double hypot, A; A = side1 * side1 + side2 * side2; hypot = sqrt( A ); return(hypot); }

Unfortunately, the answers for the hypotenuse I get are 1.Code:<pegasus> g++ hypotenuse.cpp <pegasus> a.out Enter the lengths of the two sides: 3.0 4.0 5.0 12.0 8.0 15.0 Triangle Side 1 Side 2 Hypotenuse 1 3.0 4.0 1 2 5.0 12.0 1 3 8.0 15.0 1 <pegasus>

How can I input into the program to give me the real answer for the hypotenuse as the following:

Please someone help me to figure out how to put the real answer as part of the hypotenuse table.Code:Triangle Side 1 Side 2 Hypotenuse 1 3.0 4.0 5.0 2 5.0 12.0 13.0 3 8.0 15.0 17.0

Thank you in advance for all your help.!