// minValue2.cc   P.Conrad for CISC181, Spring 2006
// Together with minValue.cc, demonstrates overloaded functions

#include <iostream>

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

// function min for two int values

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 

int minValue( int x, int y , int z) 
{ 
  cout << "Called minValue with 3 int arguments: " << x 
       << " " << y << " " << z << endl;

  return minValue(minValue(x,y),z);
  
} // end minValue 


double minValue( double x, double y ) 
{ 
  cout << "Called minValue with 2 double arguments: " << x << " " << y << endl;
  if (x < y)
    return x;
  else 
    return y;
  
} // end minValue 


char minValue( char x, char y ) 
{ 
  cout << "Called minValue with 2 char arguments: " << x << " " << y << endl;
  if (x < y)
    return x;
  else 
    return y;
  
} // end minValue 




int main(void)
{
   int firstResult = minValue( 5, 7 );         // calls int version
   double secondResult = minValue( 6.0, 8.0 ); // calls double version
   char thirdResult = minValue( 't','r' ); // calls char version
   int fourthResult = minValue( 1,2,3 ); // calls int version with 3 args



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

} // end main







