// by Suzuki // December 2001 //This is an example of a template function //that works for string and integers #include // Provides EXIT_SUCCESS #include // Provides cout #include // Provides string class using namespace std; template Item maximal(Item a, Item b); void main( ) { string s1 = "this_is_a_long_string"; string s2="short_string"; cout << "This is the longer string " << maximal(s1, s2) << endl; cout << "This is the bigger integer " << maximal(10, 20) << endl; } template Item maximal(Item a, Item b) { if (a > b) return a; else return b; }