⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polynomial.h

📁 数据结构答案 金元平
💻 H
字号:
// Polynomial.h: interface for the Polynomial class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_POLYNOMIAL_H__5E57F673_4379_4E42_9D1E_C1D6841E2BCA__INCLUDED_)
#define AFX_POLYNOMIAL_H__5E57F673_4379_4E42_9D1E_C1D6841E2BCA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <iostream>
#include <cmath>
using namespace std;
#include "CircList.h"
#include "CircListIterator.h"

struct Term
{
	float coef;
	int exp;

	Term(float c, int e)
		:coef(c), exp(e)
	{
	}

	void init(float c, int e)
	{
		coef = c;
		exp = e;
	}
	
};

class Polynomial  
{
	friend istream& operator>>(istream&, Polynomial&);
	friend ostream& operator<<(ostream&, const Polynomial&);


public:
	float evaluate(float x);
	Polynomial operator*(const Polynomial& p);
	Polynomial operator-(const Polynomial& p);
	Polynomial operator+(const Polynomial& p);
	const Polynomial& operator=(const Polynomial &p);
	Polynomial(const Polynomial& p);
	Polynomial();
	virtual ~Polynomial();

//private:
	void newTerm(int c, int e);
	CircList<Term> poly;

};

#endif // !defined(AFX_POLYNOMIAL_H__5E57F673_4379_4E42_9D1E_C1D6841E2BCA__INCLUDED_)

⌨️ 快捷键说明

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