home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Using Visual C++ 4 (Special Edition)
/
Using_Visual_C_4_Special_Edition_QUE_1996.iso
/
ch14
/
templmid.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-18
|
285b
|
15 lines
#include <iostream.h>
// This is the function template definition
template <class Type>
Type Middle(Type a, Type b, Type c)
{
return (a <= b ? (b <= c ? b : Middle(a, c, b)) :
Middle(b, a, c));
}
void main()
{
cout << "Middle(3, 12, 5) is " << Middle(3, 12, 5);
}