// max.cpp - return maximum of two arguments #include using namespace std; template T max(T &t1, T &t2) { return ((t2 > t1) ? t2 : t1); } char* max(char* &s1, char* &s2) { cout << " using specialization\n"; return ((strcmp(s1,s2)>0) ? s1 : s2); } void main() { cout << "the maximum of 1 and 2 is " << max(1,2) << "\n\n"; cout << "the maximum of 0.75 and 0.5e+10 is " << max(0.75,0.5e+10) << "\n\n"; char *s = "a string"; char *t = "z string"; cout << "the maximum of \"z string\" and \"a string\" is \"" << max(t,s) << "\"\n\n"; }