帮忙我解决error问题
//This program demonstrates function templates.#include<iostream>、
using namespace std;
template<class Type>
Type Max(Type x,Type y)
{
return(x>y)?x:y;
}
template<class Type>
void Swap(Type& x,Type y)
{
Type temp;
temp=x;
x=y;
y=temp;
}
template<class TypeA,class TypeB>
TypeA Func(TypeA x,TypeB y)
{
TypeA r;
r= 3*x + 2*y;
return r;
}
template<class Type>
Type Sum(Type[],int n)
{
Type t=0;
for(int i=0;i<n;++i)
t+=a[i];
return t;
}
int main()
{
int i=3,j=5;
double d=8.62;,e=4.14;
float f_arr[6]={1.2,2.3,3.4,4.5,5.6,6.7};
int i_arr[4]={4,5,6,7};
cout<<"i="<<i<<"and j="<<j<<endl;
cout<<"d="<<d<<"and e="<<e<<endl<<endl;
cout<<"The larger of i and j is "<<Max(i,j)<<endl;
cout<<"The larger of dand e is "<<Max(d,e)<<endl<<endl;
Swap(i,j);
Swap(d,e);
cout<<"i="<<i<<"and j="<<j<<endl;
cout<<"d="<<d<<"and e="<<e<<endl<<endl;
cout<<"Func() applied to i and d is"<<Func(i,d)<<endl;
cout<<"Func() applied ro d and i is"<<Func(d,i)<<endl<<endl;
cout<<"The sum of f_arr[] is "<<Sum(f_arr,6)<<endl;
cout<<"The sum of i_arr[] is "<<Sum(i_arr,4)<<endl;
return 0;
}