CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <algorithm>
using namespace std;
template < class T > // or template< class T >
T maximum( T value1, T value2, T value3 )
{
T maximumVAlue = std::max(value1,value2,value3);
return maximumVAlue;
}
int main()
{
// demonstrate maximum with int values
int int1, int2, int3;
cout << "Input three integer values: ";
cin >> int1 >> int2 >> int3;
// invoke int version of maximum
cout << "The maximum integer value is: "
<<maximum( int1, int2, int3 ) ;
// demonstrate maximum with double values
double double1, double2, double3;
cout << "\n\nInput three double values: ";
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run