关于运算符重载的问题求助
自己敲代码,是关于运算符重载的,但运行不通过,自己也看不出来问题到底在哪里了,求高手解疑#include<iostream.h>
class Complex
{
public:
float r;
float i;
Complex(float x=0,float y=0)
{
r=x;
i=y;
}
};
Complex operator+ (Complex c1,Complex c2)
{
Complex temp;
temp.r= c1.r + c2.r;
temp.i= c1.i + c2,i;
return temp;
}
void main()
{
Complex complex1(3.34f,4.8f),complex2(12.8f,5.2f);
Complex complex;
complex=operator+ (complex1,complex2);
cout<<complex.r<<'+'<<complex.i<<'i'<<endl;
}