类方法实现复数加减运算

来源:学生作业帮助网 编辑:六六作业网 时间:2024/05/15 02:00:58
类方法实现复数加减运算类方法实现复数加减运算类方法实现复数加减运算#include#includeusingnamespacestd;classcomplex{public:complex(){rea

类方法实现复数加减运算
类方法实现复数加减运算

类方法实现复数加减运算
#include
#include
using namespace std;
class complex
{
public:
complex(){real=0;imag=0;}
complex(double r,double i){real=r;imag=i;}
complex operator+(complex &c);
complex operator-(complex &c);
void display()
{cout