diff --git a/c++/max.cpp b/c++/max.cpp new file mode 100644 --- /dev/null +++ b/c++/max.cpp @@ -0,0 +1,31 @@ +#include +#include + +using namespace std; + +template +void maxx(T a, T b) { + if (a > b) + cout << b << endl; + else + cout << a << endl; +} + +void maxx(int a, int b) { + cout << "handle ints special..." << endl; +} + +int main(int argc, char **argv) +{ + double d1=3.2, d2=5.2; + + try { + maxx(3.5, 5.1); + maxx(5, 1); + maxx(d1, d2); + } catch (exception &e) { + cout << e.what(); + } + + return 0; +}