一个错误的程序
请问下面的程序哪个地方错了
谢谢
#include<iostream>
using namespace std;
template <class T>
class complex_basic
{
T n1;
T n2;
public:
complex_basic(){}
complex_basic(T _n1,T _n2)
{
n1=_n1;
n2=_n2;
}
friend ostream & operator << (ostream & out,complex_basic<T> t);
};
template <class T>
ostream & operator << (ostream & out,complex_basic<T> t)
{
if(t.n2==0)
{
out<<t.n1;
}
else if(t.n2>0)
{
out<<t.n1<<'+'<<t.n2<<'i';
}
else
{
out<<t.n1<<'-'<<t.n2<<'i';
}
return out;
}
void main()
{
complex_basic <int> a(5,0);
cout<<a;
}