fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename T>
  5. T myMax(T a, T b)
  6. {
  7. return (a > b) ? a : b;
  8. }
  9.  
  10. int main()
  11. {
  12. cout << "myMax(3, 7) = " << myMax(3, 7) << endl;
  13. cout << "myMax(3.5, 1.2) = " << myMax(3.5, 1.2) << endl;
  14. cout << "myMax('a', 'z') = " << myMax('a', 'z') << endl;
  15. cout << "myMax(999999999LL, 1000000000LL) = " << myMax(999999999LL, 1000000000LL) << endl;
  16. cout << "myMax(2.4f, 9.1f) = " << myMax(2.4f, 9.1f) << endl;
  17. cout << "myMax(true, false) = " << myMax(true, false) << endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
myMax(3, 7) = 7
myMax(3.5, 1.2) = 3.5
myMax('a', 'z') = z
myMax(999999999LL, 1000000000LL) = 1000000000
myMax(2.4f, 9.1f) = 9.1
myMax(true, false) = 1