SOURCE FILE: triple_check.cpp



/*   
     This is a little program that you can use to check to see if three
     integers are a Pythagorean triple.  You enter three integers, in
     ascending order (small to large) and the program tells you whether the
     square of the third integer is equal to the sum of the squares of the
     first two integers.
*/

#include <iostream>
using namespace std ;

int main (void)
{
  int A, B, H ;

  cout << endl ;
  cout << "Enter three postitive integers in small-to-large order: " ;
  cin >> A >> B >> H ;

  cout << endl ;
  cout << "A*A + B*B is: " << A*A + B*B << endl ;
  cout << "      H*H is: " << H*H << endl ;
  cout << endl ;

  if   (A*A + B*B == H*H) 
       cout << "This IS a Pythagorean triple." ;
  else cout << "This IS NOT a Pythagorean triple." ;

  cout << endl << endl ;

  return 0;
}