📄 poly.h
字号:
//////////////////////////////////////////////////////////////////////
//
// poly.h: interface for the poly class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_POLY_H__6B123B67_B2C9_5F43_1934_00F0B03A_00__INCLUDED_)
#define AFX_POLY_H__6B123B67_B2C9_5F43_1934_00F0B03A_00__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
typedef enum {allocFail, invalidCoefficient} exceptions;
class poly
{
public:
//constructor and destructors
poly(int inSize=1);
poly(int inSize, double values[]); // NOTE:highest coefficient first
// for 'natural' format
poly(poly &orig);
virtual ~poly();
//getter functions or accessor functions
void setCoef(int term, double value);
double getCoef(int term);
int getSize() ;
// overloaded binary operators for class poly
poly operator+(const poly &p);
poly operator*(const poly &p);
poly operator/(const poly &p);
poly operator+(double value);
poly operator-(double value);
poly operator-(const poly &p);
poly operator*(double value);
poly operator/(double value);
poly &operator=(const poly &p);
//friend functions for symmetrical operations with doubles
friend poly operator*(double value, const poly &p);
friend poly operator+(double value, const poly &p);
friend poly operator-(double value, const poly &p);
// overloaded unary operators
poly operator-(); //inverse
poly operator+(); //identity
// overloaded subscript access operator
double &operator[](int term);
//utility functions
float evaluate(float);
poly integrate();
poly differenciate();
poly normalise();
int checkZero();
void zero();
void clean();
//promote and demote degree of poly
poly proP(int value);
poly demP(int value);
// print
void print();
void fullPrint();
protected:
double *data;
int size;
};
#endif // !defined(AFX_POLY_H__6B123B67_B2C9_5F43_1934_00F0B03A_00__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -