[ create a new paste ] login | about

Link: http://codepad.org/E2DK2FeL    [ raw code | output | fork ]

C++, pasted on Nov 8:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#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=5, j=6, k; 
long l=10, m=5, n; 
k=GetMax<int>(i,j); 
n=GetMax<long>(l,m); 
cout << k << endl; 
cout << n << endl; 
return 0; 
}


Output:
1
2
6
10


Create a new paste based on this one


Comments: