|
- #include <iostream>
- #include <cstdlib>
- using std::cout;
- using std::cin;
- using std::endl;
- template <class T>
- T maximum(T value1, T value2, T value3)
- {
- T max=value1;
- if(value2>max)
- max=value2;
- if(value3>max)
- max=value3;
- return max;
- }
- int main()
- {
- int int1,int2,int3;
- cout<<"input three integer values:\n";
- cin>>int1>>int2>>int3;
- cout<<"maximum(int1,int2,int3) = "<<maximum(int1,int2,int3);
- cout<<endl;
- system("pause");
- return 0;
- }
复制代码 |
|