照书上敲的......结果...
#include<iostream>using namespace std;
template <typename T>;
T max(T a,T b,T c)
{
if(b>a) a=b;
if(c>a) a=c;
return a;
}
int main()
{int i1=8,i2=5,i3=6,i;
double d1=56.9,d2=90.765,d3=43.1,d;
long g1=678984,g2=-1245,g3=-45461,g;
i=max(i1,i2,i3);
d=max(d1,d2,d3);
g=max(g1,g2,g3);
cout << "i_max="<<i<<endl;
cout <<"f_max="<<f<<endl;
cout <<"g_max=""<<G<<endl;
return 0;
}
C:\Documents and Settings\4-2\xxm.cpp(4) : error C2059: syntax error : '<end Parse>'
C:\Documents and Settings\4-2\xxm.cpp(7) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\4-2\xxm.cpp(7) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\4-2\xxm.cpp(16) : error C2065: 'i' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(16) : error C2065: 'max' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(17) : error C2065: 'd' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(18) : error C2065: 'g' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(19) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
xxm.obj - 8 error(s), 0 warning(s)