// Overloaded functions

#include <iostream>

using std::cout;
using std::endl;

// function min for two int values
#if (0)
int minValue( int x, int y ) 
{ 
  cout << "Called minValue with 2 int arguments: " << x << " " << y << endl;
  if (x < y)
    return x;
  else
    return y;

} // end minValue 
#endif

//  *********** NOTE ***********
// There is no difference in using the if/else
// vs. the ternary operator except a style difference
//
// The choice to use the ternary op for double and the if/else
// for integers was an arbitrary choice.  I used a different
// approach just to show that both choices are viable.
// We could have used the if/else in both cases, or the ternary
// op in both cases.


// function minValue for double values

double minValue( double x, double y ) 
{ 
  cout << "Called minValue with 2 double arguments: " << x << " "<< y << endl;
  return ( x < y ? x : y ); 

} // end minValue (double version)



int main(void)
{
   int firstResult = minValue( 5, 7 );         // calls int version
   double secondResult = minValue( 5.0, 7.0 ); // calls double version

   cout << "The result of the first call is  :" << firstResult << "\n"
        << "The result of the second call is :" << secondResult << "\n"
        << endl;    
   
   return 0;  // success

} // end main







