// function template
#include <iostream>
using namespace std;
template <class T>
T GetMax (T a, T B)/> {
T result;
result = (a>B)/>? a : b;
return (result);
}
int main () {
int i=10, j=10, k;
long l=10, m=10, n;
k=GetMax<int>(i,j);
n=GetMax<long>(l,m);
cout << k << endl;
cout << n << endl;
return 0;
}
This post has been edited by Salem_c: 06 October 2012 - 09:50 PM
Reason for edit:: added [code][/code] tags - learn to use them yourself

New Topic/Question
Reply



MultiQuote





|