Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- using namespace std;
- /*
- Add `int max_of_four(int a, int b, int c, int d)` here.
- */
- template<typename T>
- T my_max(T a, T b)
- {
- return (a > b ? a : b);
- }
- template<typename T, typename ... Types>
- T my_max(T a, Types ... types)
- {
- return my_max(a, my_max(types...));
- }
- int max_of_four(int a, int b, int c, int d)
- {
- return my_max(a, b, c, d);
- }
- int main() {
- int a, b, c, d;
- scanf("%d %d %d %d", &a, &b, &c, &d);
- int ans = max_of_four(a, b, c, d);
- printf("%d", ans);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement