1
0

16_max.cpp 350 B

123456789101112131415161718
  1. #include <iostream>
  2. using namespace std;
  3. template <typename T>
  4. T Max(T a, T b) { return (a > b) ? a : b; }
  5. int main()
  6. {
  7. int a, b;
  8. double c, d;
  9. a = 2;
  10. b = 7;
  11. c = 3.5;
  12. d = 10.25;
  13. cout << "Maximum of " << a << " and " << b << " is " << Max(a, b) << endl;
  14. cout << "Maximum of " << c << " and " << d << " is " << Max(c, d) << endl;
  15. return 0;
  16. }