这个复杂的重载函数有什么问题?
#include<iostream.h>
#include<conio.h>
class complex
{
private:
float real,imag;
public:
complex()
{}
complex(float r,float i)
{
real=r;
imag=i;
}
void display()
{
cout<<"the complex is \t"<<real<<"+i."<<imag;
}
complex operator * (complex c1,complex c2)
{
complex t;
t.real=c1.real*real-imag*c1.imag;
t.imag=real*c1.imag+c1.real*imag;
return(t);
}
};
void main()
{
clrscr();
complex c1(4,-5);
complex c2(9,-2);
complex c3;
c3=c1*c2;
c3.display();
getch();
}