template

templ ate < cl ass T > // or templ ate< typename T >

T maxi mum( T val ue1, T val ue2, T val ue3 )

{

T maxi mumVal ue = value1; // assume val ue1 i s maxi mum

// determi ne whether val ue2 i s greater than maxi mumVal ue

i f ( val ue2 > maxi mumVal ue )

maxi mumVal ue = val ue2;

// determi ne whether val ue3 i s greater than maxi mumVal ue

i f ( val ue3 > maxi mumVal ue )

maxi mumVal ue = val ue3;

return maxi mumVal ue;

} // end functi on template maxi mum
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *