📄 complex.h
字号:
#include "iostream.h"
class complex{
private:
double rpart;
double ipart;
public:
complex() //complex a;
{
rpart = ipart = 0.0;
}
complex(double rp,double ip) //complex b(1.1,2.2);
{
rpart=rp;
ipart=ip;
}
complex(double d)//complex c(3.3);
{
rpart = d;
ipart=0.0;
}
const complex add(const complex& com);
const complex operator+(const complex& com); //成员函数版
// friend const complex operator+(const complex& x, const complex& y);//友员函数版
friend const complex operator*( const complex& x, const complex& y);
complex operator-();//单目减 ,不能写成const complex operator-() 因为:-a+b
void print();
friend ostream& operator<<(ostream& os, const complex& com);
friend istream& operator>>(istream& is, complex& com);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -