Demo entry 6737281



Submitted by anonymous on Apr 30, 2018 at 08:44
Language: C++. Code size: 1.3 kB.

#include <iostream>
#include <string>
#define MAX_POWER 201 //定义多项最高幂数
using namespace std;
class poly {
	struct concrete_poly {
		int coifficient[MAX_POWER]; //使用数组表示具体多项式,a[i]表示x^i系数
		string name;				//具体多项式的名字
		void show();				//输出多项式的函数
	struct node {
		concrete_poly cp;
		node *next;

	concrete_poly cp;				//储存具体多项式的数据
	static node *p_head;			//链表头指针
	long long power(int num, int pow); //一个简单的返回整数num的pow次幂的函数
	poly(poly &p);
	static void show_all();			//静态函数,显示已经储存的多项式
	void show();					//显示当前对象储存的多项式
	static bool search(string name);//搜索储存里是否有这个名字的多项式,有返回true,无范湖false
	static void clear();			//清空静态指针指向的链表
	static void save(poly& p);		//把多项式保存进链表,下同
	static void save(poly& p, string name);
	poly& operator=(poly& p);		//重载了几个运算符
	bool operator==(poly& p);		//相等返回true,否则返回false
	poly operator+(poly& p);
	poly operator-(poly& p);
	poly operator*(poly& p);
	long long value(int);			//求值函数,使用long long以得到更大的精度
	poly& differentiate();			//求导函数
	friend bool operator >> (istream &in, poly& p);	

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).