自定义一个结构体复数complex,包含实部虚部.重载减法运算函数,对实部和虚部分别进行减法运算stdafx.h 是哪个库函数?

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/06 18:12:15

自定义一个结构体复数complex,包含实部虚部.重载减法运算函数,对实部和虚部分别进行减法运算
stdafx.h 是哪个库函数?

#include "stdafx.h"
#include
using namespace std;
class complex
{
protected:
double real;
double image;
public:
complex(double r=0,double i=0);
complex(const complex&other);
void print();
complex operator-(const complex&other);
};
complex::complex(double r, double i)
{
real=r;
image=i;
}
complex::complex(const complex &other)
{
real=other.real;
image=other.image;
}
void complex::print()
{
cout