![]() |
#2
百年不亮2007-04-11 20:51
回复:(czcoder)函数模板示例为什么会报错?
|
#include <iostream>
using namespace std;
template <typename T>;
T max(T x,T y)
{
if(x<y)
return y;
else
return x;
}
int main()
{
int i1=3,i2=4;
float f1=3.3,f2=4.1;
double d1=22.22,d2=232.3553;
cout<<max(i1,i2)<<endl<<max(f1,f2)<<max(d1,d2)<<endl;
return 0;
}