minimum.cpp
494 Bytes
#include <iostream>
#include <string>
using namespace std;
template < class T > T minimum (T x, T y)
{
if (x < y)
return x;
else
return y;
}
#define min(A,B) (((A)<(B))?(A):(B))
int
main ()
{
int x = 50, y = 30;
string a = "hello", b = "goodbye";
cout << "minimum for ints " << minimum (x, y) << endl;
cout << "minimum for strings " << minimum (a, b) << endl;
cout << "minimum for ints " << min(x, y) << endl;
cout << "minimum for strings " << min(a, b) << endl;
}