Untitled

mail@pastecode.io avatar
unknown
plain_text
16 days ago
347 B
1
Indexable
Never
#include <iostream>

template <typename T>
T Max(T a, T b) {
    return (a > b) ? a : b;
}

int main() {
    int a = 10, b = 20;
    std::cout << "Max of " << a << " and " << b << " is " << Max(a, b) << std::endl;

    double c = 15.5, d = 10.2;
    std::cout << "Max of " << c << " and " << d << " is " << Max(c, d) << std::endl;

    return 0;
}
Leave a Comment