Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- template <typename T>
- T Max(T a, T b)
- {
- if (b < a)
- {
- return a;
- }
- return b;
- }
- int main()
- {
- //cout << Max(2, 3);
- //cout << Max<double>(2, 3.5) << endl;
- //cout << Max<int>(2, 3.5) << endl;
- cout << max<int>(2, 3.5) << endl;
- cout << max<double>(2, 3.5) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement