complexnum.h

来自「This file implements the ComplexNum clas」· C头文件 代码 · 共 28 行

H
28
字号
//****************************************************************
// Specification file (ComplexNum.h)
// This file gives the specification of a ComplexNum ADT
//****************************************************************
#ifndef COMPLEX_NUM
#define COMPLEX_NUM

class ComplexNum
{
public:
    void Set(/*in*/double r, // real part of the complex number
		               /*in*/double i);// imaginary part of the complex number
	ComplexNum Cadd(/*in*/ComplexNum other) const;	
	ComplexNum Csub(/*in*/ComplexNum other) const;		
	ComplexNum Cmult(/*in*/ComplexNum other) const;		
	ComplexNum Cdiv(/*in*/ComplexNum other) const;		
	double Cabs() const;		
	void Print() const;// print on the screen in format (real,imag)
	double RealPart()const;
	double ImagPart()const;
	
	ComplexNum();
	ComplexNum(/*in*/double r,/*in*/double i);
private:
	double real;
	double imag;
};
#endif

⌨️ 快捷键说明

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