Please send questions to st10@humboldt.edu .
//---------------------------------------------------------------------
// File: findMax.template
// Name: Michael Main, Walter Savitch
//       (adapted by Sharon M. Tuttle)
// last modified: 3-8-04
//
// Contract: findMax : <Item> <Item> -> <Item>
//
// Purpose: return whichever is larger of val1 or val2,
//          based on <Item>'s > operator. (If they are
//          equal, simply returns val2.)
//
// preconditions: <Item> has a > operator and a copy
//                constructor. (But is this really a
//                precondition, or will C++ ensure automatically?)
//
// postconditions: if val1 > val2, returns val1; otherwise,
//                 returns val2.
//
// Examples: findMax(5, 10) == 10
//           findMax(2.7, 1.5) == 2.7
//           findMax(3, 3) == 3
//           for string s1 = "pork", s2 = "beans",
//              findMax(s1, s2) == "pork"
//---------------------------------------------------------------------

template <typename Item>
Item findMax(Item val1, Item val2)
{
    if (val1 > val2)
    {
        return val1;
    }
    else
    {
        return val2;
    }
}