#include <iostream>
using namespace Std;
Template <class t>
T Max (t A, T B)
{
Return a > B? A:B;
}
int main (int argc,char* argv[])
{
int x = 10;
int y = 20;
cout << "max =" << Max (Ten) << Endl;
CIN >> X;
return 0;
}
//////////////////////////////////////////////////////////////////
For arrays with n elements a[] to find the minimum value
/////////////////////////////////////////////////////////////////
#include <iostream>
using namespace Std;
Template <class t>//functions
T min (t a[], int n)
{
int i;
T temp = a[0];
cout << "temp = a[0]=" << temp << Endl;
for (i = 1; i < n; i++)
{
if (A[i] < temp)
temp = A[i];
cout << "temp = =" << temp << Endl;
}
return temp;
}
int main ()
{
int R;
int a[] = {1,2,3,0,5,6};
Char b[] = {' A ', ' B ', ' C ', ' A ', ' B ', ' C '};
cout << "min =" << min (A, 6) << Endl;
cout << "char min =" << min (b, 6) << Endl;
CIN >> R; Blocking
}
Two numbers maximum------the template for a function