complex.h

来自「ThinkingC++中文版」· C头文件 代码 · 共 32 行

H
32
字号
#include "iostream.h"


class complex{
private:   
	double rpart;
    double ipart;
public:     
	complex() 
	{
		rpart = ipart = 0.0;
	}
	complex(double rp,double ip)
	{  
		rpart=rp;   
		ipart=ip; 
	}			  
	
	complex(double d)
	{
		rpart = d;
		ipart=0.0;
	}

    friend const complex operator+(const complex& x, const complex& y);//友员函数版
	friend const complex operator*( const complex& x, const complex& y);

	friend ostream& operator<<(ostream& os, const complex& com);//去掉&调试??
    friend istream& operator>>(istream& is, complex& com);

};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?