/*******************************************************/
//R.A. Hillayrd
//overload.cpp
//Last Modified 10/15/2001
//program to use demonstrate function overloading
/*******************************************************/

#include

using namespace std;

//function prototypes
int min(int a, int b);           //return the smallest of two integers
int max(int a, int b);           //return the largest of two integers
double min(double a, double b);  //return the smallest of two doubles
double max(double a, double b);  //return the largers of two doubles
int min(int a, int b, int c);    //return the smallest of three integers
int max(int a, int b, int c);    //return the largers of three integers

int main()
  {
  int f = 5, g = -7, h = 3;
  double w = 33.22, x = 33.21, y = 33.33;
  cout << "smallest of " << f << " and " << g << " is " << min(f,g) << endl;
  cout << "largest of  " << f << " and " << g << " is " << max(f,g) << endl;
  cout << "smallest of " << x << " and " << y << " is " << min(x,y) << endl;
  cout << "largest of  " << x << " and " << y << " is " << max(x,y) << endl;
  //three var calls go here
  }
/***********************************************************/
//return the smallest of two integers
/***********************************************************/
int min(int var1, int var2)
  {
  if(var1 <= var2)
    return var1;
  return var2;
  }
/***********************************************************/
//return the lagrest of two integers
/***********************************************************/
int max(int var1, int var2)
  {
  if(var1 >= var2)
    return var1;
  return var2;
  }
/***********************************************************/
//return the smallest of two doubles
/***********************************************************/
double min(double var1, double var2)
  {
  if(var1 <= var2)
    return var1;
  return var2;
  }
/***********************************************************/
//return the lagrest of two doubles
/***********************************************************/
double max(double var1, double var2)
  {
  if(var1 >= var2)
    return var1;
  return var2;
  }
/***********************************************************/
/***********************Program Output**********************/
smallest of 5 and -7 is -7
largest of  5 and -7 is 5
smallest of 33.21 and 33.33 is 33.21
largest of  33.21 and 33.33 is 33.33