这个c++程序为什么错了
#include<iostream>using namespace std;
class complex
{
public:
complex(){real=0;image=0;}
complex(double r,double i):real(r),image(i){}
complex(double r){real=r;image=0;}
complex operator+(complex c1,complex c2);
void display()
{
if(image<0)cout<<real<<image<<"i"<<endl;
else cout<<real<<"+"<<image<<"i"<<endl;
}
private:
double real;
double image;
};
complex complex:: operator+(complex c1,complex c2)
{
return complex(c1.real+c2.real(),c1.image+c2.image);
}
int main()
{
complex c1(1,2),c3;
c3=c1+2.5;
c3.display();
return 0;
}
错误看不懂?