#include
using namespace std;
class complex//复数类声明
{
public://外部接口
complex(double r=0.0,double i=0.0){real=r;imag=i;} //构造函数
complex operator - (complex c2); //-重载为成员函数
void display();//输出复数
private://私有数据成员
double real;//复数实部
double imag;//复数虚部
};
complex complex::operator -(complex c2) //重载函数实现
{
complex c;
c.real=real-c2.real;
c.imag=imag-c2.imag;
return complex(c.real,c.imag);
}
void complex::display()
{ cout