Advertisement
35657

Untitled

Mar 15th, 2024
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <typename T>
  6. T Max(T left, T right) {
  7.     return left > right ? left : right;
  8. }
  9.  
  10.  
  11.  
  12. int main() {
  13.  
  14.     setlocale(LC_ALL, "ru");
  15.  
  16.     int a = 5, b = 4;
  17.  
  18.     double c = 5.7, d = 9.4;
  19.  
  20.     cout << Max(a, b) << endl;
  21.     cout << Max(c, d) << endl;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement